mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-14 18:30:23 +00:00
change RPM to INSTALL
This commit is contained in:
@ -598,6 +598,50 @@ sub convert_second_to_time {
|
||||
return $result;
|
||||
}
|
||||
|
||||
#------------------------------------------
|
||||
|
||||
=head3
|
||||
Description:
|
||||
print table
|
||||
Arguments:
|
||||
content: double dimensional array
|
||||
has_title: whether has title in content
|
||||
|
||||
eg: @content = ($title,
|
||||
@content1,
|
||||
@content2,
|
||||
......
|
||||
);
|
||||
$has_title = 1;
|
||||
print_table(\@content, $has_title);
|
||||
|
||||
or @content = (@content1,
|
||||
@content2,
|
||||
......
|
||||
);
|
||||
$has_title = 0;
|
||||
print_table(\@content, $has_title);
|
||||
|
||||
Ouput:
|
||||
--------------------------
|
||||
| xxxxxxx |
|
||||
--------------------------
|
||||
| xxx | xxxx | xx | xx |
|
||||
--------------------------
|
||||
| xx | xxxx | xxxx | xx |
|
||||
--------------------------
|
||||
|
||||
or
|
||||
|
||||
--------------------------
|
||||
| xxx | xxxx | xx | xx |
|
||||
--------------------------
|
||||
| xx | xxxx | xxxx | xx |
|
||||
--------------------------
|
||||
|
||||
=cut
|
||||
|
||||
#------------------------------------------
|
||||
sub print_table {
|
||||
my $content = shift;
|
||||
$content = shift if (($content) && ($content =~ /probe_utils/));
|
||||
@ -609,12 +653,10 @@ sub print_table {
|
||||
}
|
||||
|
||||
my @length_array;
|
||||
my $count_num = 0;
|
||||
foreach my $row (@$content) {
|
||||
$count_num = 0;
|
||||
foreach my $element (@{$row}) {
|
||||
$length_array[$count_num] = length($element) if ($length_array[$count_num] < length($element));
|
||||
$count_num++;
|
||||
for (my $i = 0; $i < @{$row}; $i++) {
|
||||
my $ele_length = length(${$row}[$i]);
|
||||
$length_array[$i] = $ele_length if ($length_array[$i] < $ele_length);
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,24 +665,20 @@ sub print_table {
|
||||
my $row_line;
|
||||
my $whole_length;
|
||||
foreach my $row (@$content) {
|
||||
$count_num = 0;
|
||||
@row_new = ();
|
||||
foreach my $element (@{$row}) {
|
||||
push @row_new, $element. " " x ($length_array[$count_num] - length($element));
|
||||
$count_num++;
|
||||
for (my $i = 0; $i < @{$row}; $i++) {
|
||||
push @row_new, ${$row}[$i] . " " x ($length_array[$i] - length(${$row}[$i]));
|
||||
}
|
||||
$row_line = "| " . join(" | ", @row_new) . " |";
|
||||
$whole_length = length($row_line);
|
||||
push @content_new, $row_line;
|
||||
}
|
||||
$whole_length = length($row_line);
|
||||
|
||||
my $title_new;
|
||||
my $title_length = length($title);
|
||||
if ($has_title) {
|
||||
if ($whole_length < $title_length) {
|
||||
if ($whole_length - 1 <= $title_length) {
|
||||
$title_new = $title;
|
||||
} elsif ($whole_length - 2 == $title_length) {
|
||||
$title_new = "|". $title. "|";
|
||||
} else {
|
||||
$title_new = " " x (($whole_length - 2 - $title_length)/2) . "$title";
|
||||
$title_new .= " " x ($whole_length - 2 - length($title_new));
|
||||
@ -649,7 +687,7 @@ sub print_table {
|
||||
}
|
||||
|
||||
my $format_line = "-" x $whole_length;
|
||||
print $format_line . "\n";
|
||||
print $format_line . "\n" if ($has_title);
|
||||
print $title_new . "\n" if ($has_title);
|
||||
print $format_line . "\n";
|
||||
foreach (@content_new) {
|
||||
|
@ -41,6 +41,8 @@ my $monitor = 1;
|
||||
#used by developer, to debug the detail information about function running
|
||||
my $debug = 0;
|
||||
|
||||
my $osdeploy_start_time;
|
||||
|
||||
#---------------------------------------------
|
||||
# Command Usage
|
||||
#---------------------------------------------
|
||||
@ -68,7 +70,7 @@ Options:
|
||||
-p Show elapsed time of each stage during provision for each node
|
||||
Support 2 output format:
|
||||
'compact': Elapsed time of provision for each node.
|
||||
'phase' : Elapsed time for DHCP, RPM, POSTSCRIPTS and POSTBOOTSCRIPTS stages, and time for whole provision.
|
||||
'phase' : Elapsed time for DHCP, INSTALL, POSTSCRIPTS and POSTBOOTSCRIPTS stages, and time for whole provision.
|
||||
'origin' : Show origin start time of each stage.
|
||||
";
|
||||
|
||||
@ -567,7 +569,7 @@ sub conclusion_report {
|
||||
Calculate the performance of provision (for each node)
|
||||
Arguments:
|
||||
performance: compact: calculate how much time spent for provision
|
||||
phase: calculate how much time spent for each status (DHCP, RPM, POSTSCRIPTS, POSTBOOTSCRIPTS)
|
||||
phase: calculate how much time spent for each status (DHCP, INSTALL, POSTSCRIPTS, POSTBOOTSCRIPTS)
|
||||
origin : show time point for each status
|
||||
reserve: reserve for other type
|
||||
Returns:
|
||||
@ -591,8 +593,8 @@ sub performance_calculation {
|
||||
|
||||
my @title_lines = (
|
||||
[qw/NODE ELAPSED/],
|
||||
[qw/NODE SVRBOOT RPM POST POSTBOOT ELAPSED/],
|
||||
[qw/NODE RPOWER DHCP BOOTLOADER KERNEL INITRD RPM POST POSTBOOT COMPLETED/],
|
||||
[qw/NODE SVRBOOT INSTALL POST POSTBOOT ELAPSED/],
|
||||
[qw/NODE RPOWER DHCP BOOTLOADER KERNEL INITRD INSTALL POST POSTBOOT COMPLETED/],
|
||||
[qw/NODE RPOWER DHCP BOOTLOADER KERNEL INITRD NETBOOTING ROOTIMG POSTBOOT COMPLETED/],
|
||||
[qw/NODE DHCP BOOTLOADER KERNEL INITRD NETBOOTING ROOTIMG POSTBOOT ELAPSED/]);
|
||||
|
||||
@ -687,7 +689,10 @@ sub performance_calculation {
|
||||
$command_input .= " -n $noderange" if ($noderange);
|
||||
$command_input .= " -p $performance";
|
||||
$command_input .= " -V" if ($verbose);
|
||||
$command_input .= " -r xxhxxm";
|
||||
my $osdeploy_end_time = time();
|
||||
my $time_for_replay = $osdeploy_end_time - $osdeploy_start_time;
|
||||
my $time_hour = ($time_for_replay - $time_for_replay%3600) / 3600 + 1;
|
||||
$command_input .= " -r $time_hour" . "h";
|
||||
probe_utils->send_msg("stdout", "", "Did not get correct time, please run '$command_input' to get correct time");
|
||||
}
|
||||
}
|
||||
@ -713,6 +718,8 @@ sub do_monitor {
|
||||
my $rst = 0;
|
||||
my $terminal = 0;
|
||||
|
||||
$osdeploy_start_time = time() if ($performance);
|
||||
|
||||
$SIG{TERM} = $SIG{INT} = sub {
|
||||
$terminal = 1;
|
||||
};
|
||||
|
Reference in New Issue
Block a user