diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index c9ce10bed..3b2803a1c 100755 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -952,6 +952,21 @@ sub mkinstall $installroot = "/install"; $globaltftpdir = "/tftpboot"; + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + if (ref($request->{arg})) { + @args=@{$request->{arg}}; + } else { + @args=($request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + my $verbose_on_off=0; + if($opt{V}){$verbose_on_off=1;} + xCAT::MsgUtils->trace(0,"d","anaconda->mkinstall: opt{V}=$opt{V} verbose_on_off=$verbose_on_off"); + #>>>>>>>used for trace log end>>>>>>> + #if ($sitetab) #{ # (my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value'); @@ -961,6 +976,9 @@ sub mkinstall { $installroot = $site_ent; } + + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: installroot = $installroot"); + #( $ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value'); @ents = xCAT::TableUtils->get_site_attribute("tftpdir"); $site_ent = $ents[0]; @@ -968,6 +986,7 @@ sub mkinstall { $globaltftpdir = $site_ent; } + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: globaltftpdir = $globaltftpdir"); #} my $node; @@ -1035,13 +1054,17 @@ sub mkinstall $xcatmaster = '!myipfn!'; } + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: xcatmaster = $xcatmaster"); + my $osinst; if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) { $tftpdir = $rents{$node}->[0]->{tftpdir}; } else { $tftpdir = $globaltftpdir; } + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: tftpdir = $tftpdir"); my $ent = $osents{$node}->[0]; #$ostab->getNodeAttribs($node, ['profile', 'os', 'arch']); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: provmethod = $ent->{provmethod}"); if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { $imagename=$ent->{provmethod}; #print "imagename=$imagename\n"; @@ -1155,6 +1178,12 @@ sub mkinstall $netdrivers = $ph->{netdrivers}; $driverupdatesrc = $ph->{driverupdatesrc}; $osupdir = $ph->{'osupdir'}; + + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: imagename = $imagename"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: tmplfile = $tmplfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: partfile = $partfile"); } else { $os = $ent->{os}; @@ -1184,6 +1213,11 @@ sub mkinstall #get the partition file from the linuximage table my $imgname = "$os-$arch-install-$profile"; + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: imagename = $imgname"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: tmplfile = $tmplfile"); + if ( ! $linuximagetab ) { $linuximagetab = xCAT::Table->new('linuximage'); } @@ -1192,6 +1226,7 @@ sub mkinstall (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'partitionfile'); if ( $ref1 and $ref1->{'partitionfile'}){ $partfile = $ref1->{'partitionfile'}; + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: partfile = $partfile"); } } #can not find the linux osiamge object, tell users to run "nodeset osimage=***" @@ -1366,6 +1401,7 @@ sub mkinstall &insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); } } + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: copy initrd.img and vmlinuz to $tftppath"); } #We have a shot... @@ -1581,7 +1617,11 @@ sub mkinstall $k = "$rtftppath/vmlinuz"; $i = "$rtftppath/initrd.img"; } - + + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: kcmdline = $kcmdline"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: kernal = $k"); + xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: initrd = $i"); + $bptab->setNodeAttribs( $node, { diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index c23c99498..9a3971cb6 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -445,6 +445,21 @@ sub mkinstall { my $osimagetab; my %img_hash=(); + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + if (ref($request->{arg})) { + @args=@{$request->{arg}}; + } else { + @args=($request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + my $verbose_on_off=0; + if($opt{V}){$verbose_on_off=1;} + xCAT::MsgUtils->trace(0,"d","debian->mkinstall: opt{V}=$opt{V} verbose_on_off=$verbose_on_off"); + #>>>>>>>used for trace log end>>>>>>> + my $installroot; $installroot = "/install"; if ($sitetab) @@ -455,7 +470,9 @@ sub mkinstall { $installroot = $ref->{value}; } } - + + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: installroot = $installroot"); + my $node; my $ostab = xCAT::Table->new('nodetype'); my %donetftp; @@ -602,6 +619,11 @@ sub mkinstall { $pkgdir="$installroot/$os/$arch"; } $pkglistfile=$ph->{pkglist}; + + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: imagename = $imagename"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: tmplfile = $tmplfile"); } else { $os = $ent->{os}; @@ -622,6 +644,9 @@ sub mkinstall { } $pkgdir="$installroot/$os/$arch"; + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: tmplfile = $tmplfile"); } if ($arch eq "x86_64") { @@ -880,6 +905,10 @@ sub mkinstall { $kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs"; } + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: kcmdline = $kcmdline"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: kernal = $rtftppath/vmlinuz"); + xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: initrd = $rtftppath/initrd.img"); + $bptab->setNodeAttribs($node, { kernel => "$rtftppath/vmlinuz", initrd => "$rtftppath/initrd.img", kcmdline => $kcmdline }); diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index a62d00abb..15d78c0f8 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -93,9 +93,16 @@ sub setdestiny { @ARGV = @{$req->{arg}}; my $noupdateinitrd; my $ignorekernelchk; + my $verbose; #>>>>>>>used for trace log>>>>>>> GetOptions('noupdateinitrd' => \$noupdateinitrd, - 'ignorekernelchk' => \$ignorekernelchk,); - + 'ignorekernelchk' => \$ignorekernelchk, + 'V' => \$verbose); #>>>>>>>used for trace log>>>>>>> + + #>>>>>>>used for trace log start>>>>>>> + my $verbose_on_off=0; + if($verbose){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + my $state = $ARGV[0]; my $reststates; @@ -360,6 +367,7 @@ sub setdestiny { foreach my $tempstate (keys %state_hash1) { my $samestatenodes=$state_hash1{$tempstate}; #print "state=$tempstate nodes=@$samestatenodes\n"; + xCAT::MsgUtils->trace($verbose_on_off,"d","destiny->process_request: issue mk$tempstate request"); $errored=0; $subreq->({command=>["mk$tempstate"], node=>$samestatenodes, diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 96ef87cf7..84b7d4f03 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1020,7 +1020,9 @@ sub preprocess_request my $callback = shift; my $rc = 0; - + #>>>>>>>used for trace log>>>>>>> + my $verbose_on_off=0; + Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; Getopt::Long::Configure("no_pass_through"); @@ -1042,7 +1044,8 @@ sub preprocess_request 'n' => \$opt{n}, 'r' => \$opt{r}, 's=s' => \$statements, # $statements is declared globally - 'q' => \$opt{q} + 'q' => \$opt{q}, + 'V' => \$opt{V} #>>>>>>>used for trace log>>>>>>> )) { # If the arguements do not pass GetOptions then issue error message and return @@ -1052,9 +1055,13 @@ sub preprocess_request return 1; } + #>>>>>>>used for trace log>>>>>>> + if($opt{V}){ $verbose_on_off=1;} + # check the syntax $rc = check_options($req, \%opt,$callback); if ( $rc ) { + xCAT::MsgUtils->trace($verbose_on_off,"e","dhcp: command syntax error"); return []; } @@ -1064,6 +1071,7 @@ sub preprocess_request if (defined($t_entry)) { $snonly=$t_entry; } + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: disjointdhcps = $t_entry"); my @requests=(); my $hasHierarchy=0; @@ -1134,6 +1142,11 @@ sub preprocess_request } } + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: nodes are $str_node"); + # If service node and not -n option if (($snonly == 1) && (!$opt{n})) { # if a list of nodes are specified @@ -1193,6 +1206,8 @@ sub preprocess_request } } + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: hasHierarchy = $hasHierarchy"); + if ( $hasHierarchy) { #hierarchy detected, enforce more rigorous sanity @@ -1228,6 +1243,9 @@ sub process_request my $rsp; #print Dumper($req); + #>>>>>>>used for trace log>>>>>>> + my $verbose_on_off=0; + Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; Getopt::Long::Configure("no_pass_through"); @@ -1247,7 +1265,8 @@ sub process_request 'n' => \$opt{n}, 'r' => \$opt{r}, 's=s' => \$statements, # $statements is declared globally - 'q' => \$opt{q} + 'q' => \$opt{q}, + 'V' => \$opt{V} #>>>>>>>used for trace log>>>>>>> )) { # If the arguements do not pass GetOptions then issue error message and return @@ -1257,12 +1276,15 @@ sub process_request return 1; } - + #>>>>>>>used for trace log>>>>>>> + if($opt{V}){ $verbose_on_off=1;} + # Check options again in case we are called from plugin and options have not been processed my $rc = 0; $rc = check_options($req, \%opt,$callback); if ( $rc ) { + xCAT::MsgUtils->trace($verbose_on_off,"e","dhcp: there is invalid option in command"); return []; } @@ -1293,6 +1315,7 @@ sub process_request } if($isok == 0) { #do nothing if it is a service node, but not dhcpserver + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: it is a service node, but not dhcpserver. Do nothing"); print "Do nothing\n"; return; } @@ -1387,6 +1410,11 @@ sub process_request } else { $site_domain = $t_entry; } + + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: sitelogservers = $sitelogservers"); + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: sitentpservers = $sitentpservers"); + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: sitenameservers = $sitenameservers"); + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: site_domain = $site_domain"); } @dhcpconf = (); @@ -1397,6 +1425,7 @@ sub process_request flock($dhcplockfd,LOCK_EX); if ($::XCATSITEVALS{externaldhcpservers}) { # do nothing if remote dhcpservers at this point + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: remote dhcpservers at this point, do nothing"); } elsif ($opt{n}) { if (-e $dhcpconffile) { if ($^O eq 'aix') { @@ -1426,10 +1455,12 @@ sub process_request my $bakname = "$dhcpconffile.xcatbak"; rename("$dhcpconffile", $bakname); + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: Renamed existing dhcp configuration file to $dhcpconffile.xcatbak"); } } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: load dhcp config file $dhcpconffile"); my $rconf; open($rconf, $dhcpconffile); # Read file into memory if ($rconf) @@ -1920,7 +1951,8 @@ sub process_request } writeout(); if (not $::XCATSITEVALS{externaldhcpservers} and $restartdhcp) { - if ( $^O eq 'aix') + xCAT::MsgUtils->trace($verbose_on_off,"d","dhcp: restart dhcp service"); + if ( $^O eq 'aix') { restart_dhcpd_aix(); } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 5aea7433e..0f1d70884 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -341,9 +341,15 @@ sub preprocess_request { @ARGV = @args; my $nodes = $req->{node}; #use Getopt::Long; + my $HELP; + my $VERSION; + my $VERBOSE; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); - if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) { + if (!GetOptions('h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'V' => \$VERBOSE #>>>>>>>used for trace log>>>>>>> + ) ) { if($usage{$command}) { my %rsp; $rsp{data}->[0]=$usage{$command}; @@ -352,6 +358,12 @@ sub preprocess_request { return; } + #>>>>>>>used for trace log start>>>>>> + my $verbose_on_off=0; + if($VERBOSE){$verbose_on_off=1;} + #xCAT::MsgUtils->trace(1,"d","grub2: VERBOSE=$VERBOSE verbose_on_off=$verbose_on_off "); + #>>>>>>>used for trace log end>>>>>>> + if ($HELP) { if($usage{$command}) { my %rsp; @@ -384,6 +396,8 @@ sub preprocess_request { my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: sharedtftp = $t_entry"); + if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) { # check for computenodes and servicenodes from the noderange, if so error out my @SN; @@ -423,6 +437,21 @@ sub process_request { my @args; my @nodes; my @rnodes; + + #>>>>>>>used for trace log start>>>>>>> + #my @args=(); + my %opt; + my $verbose_on_off=0; + if (ref($::XNBA_request->{arg})) { + @args=@{$::XNBA_request->{arg}}; + } else { + @args=($::XNBA_request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + if (ref($request->{node})) { @rnodes = @{$request->{node}}; } else { @@ -448,7 +477,12 @@ sub process_request { } else { @nodes = @rnodes; } - + + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: nodes are $str_node"); + # return directly if no nodes in the same network unless (@nodes) { xCAT::MsgUtils->message("S", "xCAT: grub2 netboot: no valid nodes. Stop the operation on this server."); @@ -465,11 +499,15 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $errored=0; if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children - $sub_req->({command=>['runbeginpre'], + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: the call is distrubuted to the service node already, so only need to handles my own children"); + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue runbeginpre request"); + $sub_req->({command=>['runbeginpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters - $sub_req->({command=>['runbeginpre'], + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: nodeset did not distribute to the service node"); + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue runbeginpre request"); + $sub_req->({command=>['runbeginpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); } @@ -488,6 +526,7 @@ sub process_request { if (!$inittime) { $inittime=0;} $errored=0; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue setdestiny request"); $sub_req->({command=>['setdestiny'], node=>\@nodes, inittime=>[$inittime], @@ -594,9 +633,11 @@ sub process_request { } if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}}, $callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}},$callback); } @@ -610,10 +651,12 @@ sub process_request { } if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@breaknetboot, arg=>['-l']},$callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@breaknetboot},$callback); } @@ -624,10 +667,12 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') $errored=0; if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children - $sub_req->({command=>['runendpre'], + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue runendpre request"); + $sub_req->({command=>['runendpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","grub2: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 789eaf385..7e8f5aaa8 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -248,9 +248,15 @@ sub preprocess_request { @ARGV = @args; my $nodes = $req->{node}; #use Getopt::Long; + my $HELP; + my $VERSION; + my $VERBOSE; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); - if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) { + if (!GetOptions('h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'V' => \$VERBOSE #>>>>>>>used for trace log>>>>>>> + ) ) { if($usage{$command}) { my %rsp; $rsp{data}->[0]=$usage{$command}; @@ -259,6 +265,12 @@ sub preprocess_request { return; } + #>>>>>>>used for trace log start>>>>>> + my $verbose_on_off=0; + if($VERBOSE){$verbose_on_off=1;} + #xCAT::MsgUtils->trace(1,"d","petitboot: VERBOSE=$VERBOSE verbose_on_off=$verbose_on_off "); + #>>>>>>>used for trace log end>>>>>>> + if ($HELP) { if($usage{$command}) { my %rsp; @@ -290,6 +302,7 @@ sub preprocess_request { #if they specify no sharedtftp in site table my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: sharedtftp = $t_entry"); 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; @@ -324,10 +337,25 @@ sub process_request { my $command = $request->{command}->[0]; %breaknetbootnodes=(); %normalnodes=(); + + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + my $verbose_on_off=0; + if (ref($::request->{arg})) { + @args=@{$::request->{arg}}; + } else { + @args=($::request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + if ($::XCATSITEVALS{"httpmethod"}) { $httpmethod = $::XCATSITEVALS{"httpmethod"}; } if ($::XCATSITEVALS{"httpport"}) { $httpport = $::XCATSITEVALS{"httpport"}; } - my @args; + #my @args; my @nodes; my @rnodes; if (ref($request->{node})) { @@ -356,6 +384,11 @@ sub process_request { @nodes = @rnodes; } + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: nodes are $str_node"); + # return directly if no nodes in the same network unless (@nodes) { xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: no valid nodes. Stop the operation on this server."); @@ -372,10 +405,14 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $errored=0; if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: the call is distrubuted to the service node already, so only need to handles my own children"); + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: nodeset did not distribute to the service node"); + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); @@ -395,6 +432,7 @@ sub process_request { if (!$inittime) { $inittime=0;} $errored=0; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue setdestiny request"); $sub_req->({command=>['setdestiny'], node=>\@nodes, inittime=>[$inittime], @@ -475,11 +513,13 @@ sub process_request { if ($do_dhcpsetup) { foreach my $node (@normalnodeset) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=> [$node], arg=>['-l']},$callback); #arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=> [$node]}, $callback); #arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback); @@ -492,10 +532,12 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') $errored=0; if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","petitboot: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); diff --git a/xCAT-server/lib/xcat/plugins/prescripts.pm b/xCAT-server/lib/xcat/plugins/prescripts.pm index 505e2659f..24c522799 100644 --- a/xCAT-server/lib/xcat/plugins/prescripts.pm +++ b/xCAT-server/lib/xcat/plugins/prescripts.pm @@ -43,6 +43,21 @@ sub preprocess_request my $req = shift; my $cb = shift; + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + my $verbose_on_off=0; + if (ref($req->{arg})) { + @args=@{$req->{arg}}; + } else { + @args=($req->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + xCAT::MsgUtils->trace(0,"d","prescripts->preprocess_request: opt{V}=$opt{V} verbose_on_off=$verbose_on_off"); + #>>>>>>>used for trace log end>>>>>>> + #if already preprocessed, go straight to request if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; } @@ -78,10 +93,13 @@ sub preprocess_request } # if no nodes left to process, we are done - if (! @nodes) { return; } + if (! @nodes) { + xCAT::MsgUtils->trace($verbose_on_off,"d", "prescripts->preprocess_request: no nodes left to process, we are done"); + return; + } my $service = "xcat"; - my @args=(); + @args=(); if (ref($req->{arg})) { @args=@{$req->{arg}}; } else { @@ -91,6 +109,13 @@ sub preprocess_request #print "prepscripts: preprocess_request get called, args=@args, nodes=@$nodes\n"; + #>>>>>>>used for trace log>>>>>> + my $str_node; + my $str_args; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + foreach my $str_a (@args){$str_args .= $str_a." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","prescripts->preprocess_request: get called, args=$str_args, nodes=$str_node"); + #use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -117,6 +142,7 @@ sub preprocess_request $reqcopy->{'_xcatdest'} = $hostinfo[0]; $reqcopy->{_xcatpreprocessed}->[0] = 1; push @requests, $reqcopy; + xCAT::MsgUtils->trace($verbose_on_off,"d","prescripts: handle request in $hostinfo[0]"); return \@requests; } } else { #run on mn and need to dispatch the requests to the service nodes @@ -130,6 +156,7 @@ sub preprocess_request $reqcopy->{node} = $sn->{$snkey}; $reqcopy->{'_xcatdest'} = $snkey; $reqcopy->{_xcatpreprocessed}->[0] = 1; + xCAT::MsgUtils->trace($verbose_on_off,"d","prescripts: handle request in $snkey"); push @requests, $reqcopy; } # end foreach diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index abc766aef..745ef8a8c 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -295,9 +295,15 @@ sub preprocess_request { @args=($req->{arg}); } @ARGV = @args; + my $HELP; + my $VERSION; + my $VERBOSE; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); - if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) { + if (!GetOptions('h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'V' => \$VERBOSE #>>>>>>>used for trace log>>>>>>> + ) ) { if($usage{$command}) { my %rsp; $rsp{data}->[0]=$usage{$command}; @@ -306,6 +312,12 @@ sub preprocess_request { return; } + #>>>>>>>used for trace log start>>>>>> + my $verbose_on_off=0; + if($VERBOSE){$verbose_on_off=1;} + #xCAT::MsgUtils->trace(1,"d","pxe: VERBOSE=$VERBOSE verbose_on_off=$verbose_on_off "); + #>>>>>>>used for trace log end>>>>>>> + if ($HELP) { if($usage{$command}) { my %rsp; @@ -335,6 +347,7 @@ sub preprocess_request { #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: sharedtftp = $t_entry"); if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) { # check for computenodes and servicenodes from the noderange, if so error out my @SN; @@ -370,6 +383,20 @@ sub process_request { my @args; my @nodes; my @rnodes; + + #>>>>>>>used for trace log start>>>>>>> + my %opt; + my $verbose_on_off=0; + if (ref($::PXE_request->{arg})) { + @args=@{$::PXE_request->{arg}}; + } else { + @args=($::PXE_request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + if (ref($::PXE_request->{node})) { @rnodes = @{$::PXE_request->{node}}; } else { @@ -397,6 +424,11 @@ sub process_request { @nodes = @rnodes; } + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: nodes are $str_node"); + # return directly if no nodes in the same network unless (@nodes) { xCAT::MsgUtils->message("S", "xCAT: pxe netboot: no valid nodes. Stop the operation on this server."); @@ -413,10 +445,14 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $errored=0; if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: the call is distrubuted to the service node already, so only need to handles my own children"); + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: nodeset did not distribute to the service node"); + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); @@ -453,6 +489,7 @@ sub process_request { if (exists($::PXE_request->{inittime})) { $inittime= $::PXE_request->{inittime}->[0];} if (!$inittime) { $inittime=0;} unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue setdestiny request"); $sub_req->({command=>['setdestiny'], node=>\@nodes, inittime=>[$inittime], @@ -518,9 +555,11 @@ sub process_request { if ($do_dhcpsetup) { if ($::PXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue makedhcp request"); $sub_req->({command=>['makedhcp'],arg=>['-l'], node=>\@nodes},$::PXE_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@nodes},$::PXE_callback); } @@ -575,10 +614,12 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') $errored=0; if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","pxe: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index ff0fbbc0a..94f28989d 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -752,6 +752,21 @@ sub mkinstall my $osimagetab; my $osdistrouptab; + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + if (ref($request->{arg})) { + @args=@{$request->{arg}}; + } else { + @args=($request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + my $verbose_on_off=0; + if($opt{V}){$verbose_on_off=1;} + xCAT::MsgUtils->trace(0,"d","sles->mkinstall: opt{V}=$opt{V} verbose_on_off=$verbose_on_off"); + #>>>>>>>used for trace log end>>>>>>> + my $ntents = $ostab->getNodesAttribs($request->{node}, ['os', 'arch', 'profile', 'provmethod']); my %img_hash=(); my $installroot; @@ -779,7 +794,9 @@ sub mkinstall $installroot = $t_entry; } #} - + + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: installroot = $installroot"); + my %donetftp; require xCAT::Template; #only used here, load so memory can be COWed # Define a variable for driver update list @@ -829,7 +846,9 @@ sub mkinstall } else { $tftpdir = $globaltftpdir; } - + + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: tftpdir = $tftpdir"); + if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { $imagename=$ent->{provmethod}; if (!exists($img_hash{$imagename})) { @@ -914,6 +933,12 @@ sub mkinstall $netdrivers = $ph->{netdrivers}; $driverupdatesrc = $ph->{driverupdatesrc}; $osupdir = $ph->{'osupdir'}; + + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: imagename = $imagename"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: tmplfile = $tmplfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: partfile = $partfile"); } else { $os = $ent->{os}; @@ -939,7 +964,12 @@ sub mkinstall #get the partition file from the linuximage table my $imgname = "$os-$arch-install-$profile"; - + + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: imagename = $imgname"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: pkgdir = $pkgdir"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: pkglistfile = $pkglistfile"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: tmplfile = $tmplfile"); + if (! $linuximagetab) { $linuximagetab = xCAT::Table->new('linuximage'); } @@ -948,6 +978,7 @@ sub mkinstall (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'partitionfile'); if ( $ref1 and $ref1->{'partitionfile'}){ $partfile = $ref1->{'partitionfile'}; + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: partfile = $partfile"); } } else { @@ -1080,18 +1111,21 @@ sub mkinstall copy("$pkgdir/1/boot/$arch/loader/linux", "$tftppath"); copy("$pkgdir/1/boot/$arch/loader/initrd", "$tftppath"); @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: copy initrd.img and linux to $tftppath"); } } elsif ($arch =~ /x86/) { unless ($noupdateinitrd) { copy("$pkgdir/1/boot/i386/loader/linux", "$tftppath"); copy("$pkgdir/1/boot/i386/loader/initrd", "$tftppath"); @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: copy initrd.img and linux to $tftppath"); } } elsif ($arch eq "ppc64le") { unless ($noupdateinitrd) { copy("$pkgdir/1/boot/$arch/linux", "$tftppath"); copy("$pkgdir/1/boot/$arch/initrd", "$tftppath"); @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: copy initrd.img and linux to $tftppath"); } } elsif ($arch =~ /ppc/) @@ -1099,6 +1133,7 @@ sub mkinstall unless ($noupdateinitrd) { copy("$pkgdir/1/suseboot/inst64", "$tftppath"); @dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: copy inst64 to $tftppath"); } } } @@ -1278,6 +1313,9 @@ sub mkinstall { $kernelpath = "$rtftppath/linux"; $initrdpath = "$rtftppath/initrd"; + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: kcmdline = $kcmdline"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: kernal = $kernelpath"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: initrd = $initrdpath"); $bptab->setNodeAttribs( $node, { @@ -1290,6 +1328,9 @@ sub mkinstall elsif ($arch =~ /ppc/) { $kernelpath = "$rtftppath/inst64"; + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: kcmdline = $kcmdline"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: kernal = $kernelpath"); + xCAT::MsgUtils->trace($verbose_on_off,"d","sles->mkinstall: initrd = "); $bptab->setNodeAttribs( $node, { diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 78012e387..cbc1bd8f9 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -317,7 +317,11 @@ sub preprocess_request { Getopt::Long::Configure("pass_through"); my $HELP; my $VERSION; - if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) { + my $VERBOSE; + if (!GetOptions('h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'V' => \$VERBOSE #>>>>>>>used for trace log>>>>>>> + ) ) { if($usage{$command}) { my %rsp; $rsp{data}->[0]=$usage{$command}; @@ -326,6 +330,12 @@ sub preprocess_request { return; } + #>>>>>>>used for trace log start>>>>>> + my $verbose_on_off=0; + if($VERBOSE){$verbose_on_off=1;} + #xCAT::MsgUtils->trace(1,"d","xnba: VERBOSE=$VERBOSE verbose_on_off=$verbose_on_off "); + #>>>>>>>used for trace log end>>>>>>> + if ($HELP) { if($usage{$command}) { my %rsp; @@ -357,6 +367,7 @@ sub preprocess_request { #they specify no sharedtftp in site table my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: sharedtftp = $t_entry"); if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) { # check for computenodes and servicenodes from the noderange, if so error out my @SN; @@ -392,6 +403,20 @@ sub process_request { my @args; my @nodes; my @rnodes; + + #>>>>>>>used for trace log start>>>>>>> + my %opt; + my $verbose_on_off=0; + if (ref($::XNBA_request->{arg})) { + @args=@{$::XNBA_request->{arg}}; + } else { + @args=($::XNBA_request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + if (ref($::XNBA_request->{node})) { @rnodes = @{$::XNBA_request->{node}}; } else { @@ -419,6 +444,11 @@ sub process_request { @nodes = @rnodes; } + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace(0,"d","xnba: nodes are $str_node"); + # return directly if no nodes in the same network unless (@nodes) { xCAT::MsgUtils->message("S", "xCAT: xnba netboot: no valid nodes. Stop the operation on this server."); @@ -435,10 +465,14 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $errored=0; if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: the call is distrubuted to the service node already, so only need to handles my own children"); + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: nodeset did not distribute to the service node"); + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); @@ -472,6 +506,7 @@ sub process_request { if (!$inittime) { $inittime=0;} $errored=0; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue setdestiny request"); $sub_req->({command=>['setdestiny'], node=>\@nodes, inittime=>[$inittime], @@ -550,9 +585,11 @@ sub process_request { if ($do_dhcpsetup) { if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue makedhcp request"); $sub_req->({command=>['makedhcp'],arg=>['-l'], node=>\@nodes},$::XNBA_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@nodes},$::XNBA_callback); } @@ -563,10 +600,12 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') $errored=0; if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","xnba: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 7061270ba..7781448b7 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -358,9 +358,15 @@ sub preprocess_request { @ARGV = @args; my $nodes = $req->{node}; #use Getopt::Long; + my $HELP; + my $VERSION; + my $VERBOSE; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); - if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) { + if (!GetOptions('h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'V' => \$VERBOSE #>>>>>>>used for trace log>>>>>>> + ) ) { if($usage{$command}) { my %rsp; $rsp{data}->[0]=$usage{$command}; @@ -368,7 +374,13 @@ sub preprocess_request { } return; } - + + #>>>>>>>used for trace log start>>>>>> + my $verbose_on_off=0; + if($VERBOSE){$verbose_on_off=1;} + #xCAT::MsgUtils->trace(1,"d","yaboot: VERBOSE=$VERBOSE verbose_on_off=$verbose_on_off "); + #>>>>>>>used for trace log end>>>>>>> + if ($HELP) { if($usage{$command}) { my %rsp; @@ -401,6 +413,8 @@ sub preprocess_request { my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: sharedtftp = $t_entry"); + if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) { # check for computenodes and servicenodes from the noderange, if so error out my @SN; @@ -438,6 +452,22 @@ sub process_request { %normalnodes=(); my @args; + + #>>>>>>>used for trace log start>>>>>>> + my @args=(); + my %opt; + my $verbose_on_off=0; + if (ref($::YABOOT_request->{arg})) { + @args=@{$::YABOOT_request->{arg}}; + } else { + @args=($::YABOOT_request->{arg}); + } + @ARGV = @args; + GetOptions('V' => \$opt{V}); + if($opt{V}){$verbose_on_off=1;} + #>>>>>>>used for trace log end>>>>>>> + + my @nodes; my @rnodes; if (ref($::YABOOT_request->{node})) { @@ -466,6 +496,11 @@ sub process_request { @nodes = @rnodes; } + #>>>>>>>used for trace log>>>>>>> + my $str_node; + foreach my $str_n (@nodes){$str_node .= $str_n." ";} + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: nodes are $str_node"); + # return directly if no nodes in the same network unless (@nodes) { xCAT::MsgUtils->message("S", "xCAT: yaboot netboot: no valid nodes. Stop the operation on this server."); @@ -482,10 +517,14 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $errored=0; if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: the call is distrubuted to the service node already, so only need to handles my own children"); + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: nodeset did not distribute to the service node"); + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue runbeginpre request"); $sub_req->({command=>['runbeginpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along); @@ -504,6 +543,7 @@ sub process_request { if (!$inittime) { $inittime=0;} $errored=0; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue setdestiny request"); $sub_req->({command=>['setdestiny'], node=>\@nodes, inittime=>[$inittime], @@ -710,10 +750,12 @@ sub process_request { } } if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}, arg=>['-l']},$::YABOOT_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback); } @@ -725,9 +767,11 @@ sub process_request { } if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'],arg=>['-l'], node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback); } @@ -735,9 +779,11 @@ sub process_request { } } else { if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'],arg=>['-l'], node=>\@normalnodeset},$::YABOOT_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@normalnodeset},$::YABOOT_callback); } @@ -748,10 +794,12 @@ sub process_request { } } if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@breaknetboot, arg=>['-l']},$::YABOOT_callback); } else { + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue makedhcp request"); $sub_req->({command=>['makedhcp'], node=>\@breaknetboot}, $::YABOOT_callback); } @@ -762,10 +810,12 @@ sub process_request { unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') $errored=0; if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@nodes, arg=>[$args[0], '-l']},\&pass_along); } else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters + xCAT::MsgUtils->trace($verbose_on_off,"d","yaboot: issue runendpre request"); $sub_req->({command=>['runendpre'], node=>\@rnodes, arg=>[$args[0]]},\&pass_along);