2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 04:27:55 +00:00

fix(xcatd): only call a same-release build difference a build difference

xcatd warns "xCAT Version mismatch!" when a node's xCAT version differs
from the server's. It compared the full version strings, which include a
build-specific suffix such as " (git commit <hash>)". Two nodes at the
same release built from different snapshots then reported a version
mismatch on every request, even though the same release is ABI
compatible.

Keep warning when the versions differ, but tell the two cases apart. A
different release is still "xCAT Version mismatch!". The same release
built from a different commit now reports "xCAT build level differs (same
release):" instead, so the build difference is still visible without
being called a mismatch. Both messages show the full version strings.

Add xCAT::Version->Release, which returns the version without the
build-specific suffix, to make that distinction.

This was recovered from the lenovobuild branch, which stripped the older
"built <date>" suffix and dropped the same-release warning entirely; this
reimplements it for the current version format and keeps the build
difference visible.
This commit is contained in:
Vinícius Ferrão
2026-08-17 16:30:31 -03:00
parent 875a6ef40d
commit 7ad7293b71
2 changed files with 36 additions and 2 deletions
+30
View File
@@ -54,4 +54,34 @@ sub Version
}
#-------------------------------------------------------------------------------
=head3 Release
Arguments:
Optional version string; defaults to Version();
Returns:
the release part of the version, without the build-specific
decoration the build stamps on, such as " (git commit <hash>)",
so two nodes at the same release built from different snapshots
compare equal.
Globals:
none
Error:
none
Example:
$release=xCAT::Version->Release($someversion);
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub Release
{
my $class = shift;
my $version = shift;
$version = $class->Version() unless defined $version;
$version =~ s/\s*\(.*//s;
return $version;
}
1;
+6 -2
View File
@@ -2945,9 +2945,13 @@ sub service_connection {
#if the 2 versions are different, a warning message is included in the response
if($req->{'_xcatver'} and $req->{'_xcatver'}->[0]){
my $myxcatver=xCAT::Version->Version();
if($req->{'_xcatver'}->[0] ne $myxcatver){
my $peerxcatver=$req->{'_xcatver'}->[0];
if($peerxcatver ne $myxcatver){
my $myhostname=Sys::Hostname::hostname;
my $resp = { warning => ["xCAT Version mismatch! \n $myhostname: $myxcatver\n $peerhost: $req->{'_xcatver'}->[0]\n"]};
my $label = (xCAT::Version->Release($peerxcatver) ne xCAT::Version->Release($myxcatver))
? "xCAT Version mismatch!"
: "xCAT build level differs (same release):";
my $resp = { warning => ["$label \n $myhostname: $myxcatver\n $peerhost: $peerxcatver\n"]};
send_response($resp, $sock);
}
}