summaryrefslogtreecommitdiffstats
path: root/src/build/buildpnor/genPnorImages.pl
diff options
context:
space:
mode:
authorMegan <megan.teo@ibm.com>2019-08-07 15:08:24 -0500
committerWilliam G Hoffa <wghoffa@us.ibm.com>2019-08-28 15:19:29 -0500
commitade048149809eedef4190d7ad063eed3800d377a (patch)
treeb56d543e9118abee73ead2a5aa7a8270b85714b7 /src/build/buildpnor/genPnorImages.pl
parent4536704918f346016d5e2d6091dd8f5c33f8c4b1 (diff)
downloadtalos-hostboot-ade048149809eedef4190d7ad063eed3800d377a.tar.gz
talos-hostboot-ade048149809eedef4190d7ad063eed3800d377a.zip
Alert when a partition's space utilization exceeds a threshold
Calculate the percentage utilization of a pnor partition by using binary file size + header size + ecc overhead (if used for partition). User is warned when a pnor partition exceeds a specific utilization threshold Change-Id: I00b0b69a039ffefdf086dc470fd0f76b72ee267d RTC: 212220 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81990 Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/build/buildpnor/genPnorImages.pl')
-rwxr-xr-xsrc/build/buildpnor/genPnorImages.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/build/buildpnor/genPnorImages.pl b/src/build/buildpnor/genPnorImages.pl
index eae4e1fe7..142fd25f5 100755
--- a/src/build/buildpnor/genPnorImages.pl
+++ b/src/build/buildpnor/genPnorImages.pl
@@ -61,6 +61,11 @@ my $programName = File::Basename::basename $0;
my @systemBinFiles = ();
my %pnorLayout = ();
my %PhysicalOffsets = ();
+my %partitionUtilHash;
+
+# percentage utilization threshold, if crossed display warning message
+# that partition is almost full
+use constant CRITICAL_THRESHOLD => 85.00;
# Truncate SHA to n bytes
use constant SHA_TRUNCATE_SIZE => 32;
@@ -409,6 +414,17 @@ foreach my $binFilesCSV (@systemBinFiles)
manipulateImages(\%pnorLayout, \%binFiles, $system_target);
}
+# display percentage utilization data for each eyecatch
+foreach my $key (keys %partitionUtilHash) {
+
+ print "$key is $partitionUtilHash{$key}{pctUtilized} utilized ($partitionUtilHash{$key}{freeBytes} of $partitionUtilHash{$key}{physicalRegionSize} bytes free)\n";
+
+ # if percentage is greater than critical threshold, surface warning
+ if ($partitionUtilHash{$key}{pctUtilized} > CRITICAL_THRESHOLD) {
+ print "Warning: Percent utilization for $key shows that partition is almost full.\n";
+ }
+}
+
################################################################################
# Subroutines
################################################################################
@@ -452,6 +468,7 @@ sub partitionDepSort
################################################################################
# manipulateImages - Perform any ECC/padding/sha/signing manipulations
################################################################################
+
sub manipulateImages
{
my ($i_pnorLayoutRef, $i_binFilesRef, $system_target) = @_;
@@ -496,6 +513,7 @@ sub manipulateImages
}
my $eyeCatch = $sectionHash{$layoutKey}{eyeCatch};
+ my $physicalRegionSize = $sectionHash{$layoutKey}{physicalRegionSize};
my %tempImages = (
HDR_PHASE => "$bin_dir/$parallelPrefix.$eyeCatch.temp.hdr.bin",
TEMP_SHA_IMG => "$bin_dir/$parallelPrefix.$eyeCatch.temp.sha.bin",
@@ -749,6 +767,22 @@ sub manipulateImages
setCallerHwHdrFields(\%callerHwHdrFields, $tempImages{HDR_PHASE});
+
+ # store binary file size + header size in hash
+
+ # If section will passed through ecc, include this in size calculation
+ if( ($sectionHash{$layoutKey}{ecc} eq "yes") )
+ {
+ $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize} * (9/8);
+ }
+ else
+ {
+ $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize};
+ }
+ $partitionUtilHash{$eyeCatch}{pctUtilized} = sprintf("%.2f", $partitionUtilHash{$eyeCatch}{logicalFileSize} / $physicalRegionSize * 100);
+ $partitionUtilHash{$eyeCatch}{freeBytes} = $physicalRegionSize - $partitionUtilHash{$eyeCatch}{logicalFileSize};
+ $partitionUtilHash{$eyeCatch}{physicalRegionSize} = $physicalRegionSize;
+
# Padding Phase
if ($eyeCatch eq "HBI" && $testRun)
{
OpenPOWER on IntegriCloud