From 875acb6cfb1e8a2734715d09d44dee4728a0b9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:58:35 -0300 Subject: [PATCH] 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. --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index d3b450507c..378e4ed337 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -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); }