fixed the code so that the moncfgmaster function is not dispatched to the service nodes when not needed.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1871 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
8ed9f3a875
commit
c55eacef62
@ -1328,7 +1328,45 @@ sub configMaster4Nodes {
|
||||
return ($retcode, $message);
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
=head3 shouldConfigMaster
|
||||
This function goes to every monitoring plug-in module to check if
|
||||
anyone implements the configMaster4Nodes function.
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
1, if any monitoring plug-in module implements the configMaster4Nodes fucntion.
|
||||
0. if none.
|
||||
=cut
|
||||
#--------------------------------------------------------------------------------
|
||||
sub shouldConfigMaster {
|
||||
|
||||
#get all the module names from /opt/xcat/lib/perl/XCAT_monitoring directory
|
||||
my %names=();
|
||||
my @plugins=glob("$::XCATROOT/lib/perl/xCAT_monitoring/*.pm");
|
||||
foreach (@plugins) {
|
||||
/.*\/([^\/]*).pm$/;
|
||||
$names{$1}=1;
|
||||
}
|
||||
# remove 2 files that are not plug-ins
|
||||
delete($names{monitorctrl});
|
||||
delete($names{montbhandler});
|
||||
|
||||
#get node conf data from each plug-in module
|
||||
foreach my $pname (keys(%names)) {
|
||||
my $file_name="$::XCATROOT/lib/perl/xCAT_monitoring/$pname.pm";
|
||||
my $module_name="xCAT_monitoring::$pname";
|
||||
#load the module in memory
|
||||
eval {require($file_name)};
|
||||
if (!$@) {
|
||||
if (defined(${$module_name."::"}{configMaster4Nodes})) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -69,6 +69,11 @@ sub preprocess_request
|
||||
my $reqcopy = {%$req};
|
||||
push @requests, $reqcopy;
|
||||
} else {
|
||||
if (! xCAT_monitoring::monitorctrl->shouldConfigMaster()) {
|
||||
$req = {};
|
||||
return;
|
||||
}
|
||||
|
||||
my $nodes = $req->{node};
|
||||
my $noderef=xCAT_monitoring::monitorctrl->getMonServer($nodes);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user