mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	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:
		| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user