Skip to content

Commit

Permalink
add trace information
Browse files Browse the repository at this point in the history
  • Loading branch information
huweihua committed Aug 14, 2015
1 parent 61d8537 commit a35ca71
Show file tree
Hide file tree
Showing 11 changed files with 419 additions and 25 deletions.
42 changes: 41 additions & 1 deletion xCAT-server/lib/xcat/plugins/anaconda.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -961,13 +976,17 @@ 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];
if( defined($site_ent) )
{
$globaltftpdir = $site_ent;
}
xCAT::MsgUtils->trace($verbose_on_off,"d","anaconda->mkinstall: globaltftpdir = $globaltftpdir");
#}

my $node;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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');
}
Expand All @@ -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 <nr> osimage=***"
Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -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,
{
Expand Down
31 changes: 30 additions & 1 deletion xCAT-server/lib/xcat/plugins/debian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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};
Expand All @@ -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") {
Expand Down Expand Up @@ -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 });
Expand Down
12 changes: 10 additions & 2 deletions xCAT-server/lib/xcat/plugins/destiny.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
42 changes: 37 additions & 5 deletions xCAT-server/lib/xcat/plugins/dhcp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -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 [];
}

Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -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 [];
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 = ();
Expand All @@ -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') {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit a35ca71

Please sign in to comment.