From 725444cdd1bbd0bdb0408a45479cf64649e99084 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 21 Jul 2017 03:37:33 -0400 Subject: [PATCH] fix issue#3515: check the version of xCAT between MN and SN while processing the forwarded request --- xCAT-server/sbin/xcatd | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 99792c097..b86e523eb 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -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 = "";