2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-30 06:12:19 +00:00

fix(ipmi): read the SDR record count as one 16-bit value

got_sdr_rep_info computed the record count as
($returnd[1] + $returnd[2]) << 8, because Perl gives + a higher
precedence than <<. The count names the SDR cache of a BMC. Counts whose
two bytes have the same sum, such as 39 and 294, shared a cache. A BMC
that went from one count to the other reused the old SDR.

Shift only the MS byte, and raise the SDR cache version to 5. A cache
file from the old encoding can have the name of a new count: the file
for 257 records is named 512. The version makes each BMC model read its
SDR again once after the update.
This commit is contained in:
Vinícius Ferrão
2026-10-30 20:58:35 -03:00
parent fd3f1889be
commit 875acb6cfb
+2 -2
View File
@@ -124,7 +124,7 @@ my $cache_dir = "/var/cache/xcat";
use xCAT::data::ibmleds;
use xCAT::data::ipmigenericevents;
use xCAT::data::ipmisensorevents;
my $cache_version = 4;
my $cache_version = 5;
my %sdr_caches; #store sdr cachecs in memory indexed such that identical nodes do not hit the disk multiple times
#my $status_noop="XXXno-opXXX";
@@ -8106,7 +8106,7 @@ sub got_sdr_rep_info {
}
my @returnd = @{ $rsp->{data} };
$sessdata->{sdr_info}->{version} = $returnd[0];
$sessdata->{sdr_info}->{rec_count} = $returnd[1] + $returnd[2] << 8;
$sessdata->{sdr_info}->{rec_count} = $returnd[1] + ($returnd[2] << 8);
$sessdata->{sdr_info}->{resv_sdr} = ($returnd[13] & 0b00000010) >> 1;
initsdr_withrepinfo($sessdata);
}