2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 02:30:21 +00:00

fix issue#3515: check the version of xCAT between MN and SN while processing the forwarded request

This commit is contained in:
immarvin
2017-07-21 03:37:33 -04:00
parent cac418514f
commit 725444cdd1

View File

@@ -2301,7 +2301,8 @@ sub dispatch_request {
my $errstr;
eval {
undef $_->{'_xcatdest'};
#the xCAT version is included in the request which will be forwarded
$_->{'_xcatver'}=xCAT::Version->Version();
# mainly used by SN to filter out the incorrect module that xcat command came into
$_->{'_modname'} = $modname;
@@ -2803,6 +2804,23 @@ sub service_connection {
delete($req->{tokenid});
}
#for xcat requests forwarded from other nodes, such as MN<-->SN
# compare the version of xCAT which forwarded the request and the
# one which processes the forwarded command
#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){
require Sys::Hostname;
my $myhostname=Sys::Hostname::hostname;
my $resp = { warning => ["$myhostname: my xCAT version \"$myxcatver\" does not match the forwarder's xCAT version \"$req->{'_xcatver'}->[0]\" on $peerhost"]};
$resp->{serverdone} = [undef];
send_response($resp, $sock);
#return;
}
}
# we have a full request..
#printf $request."\n";
$request = "";