mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	changed configrmcnode from perl to shell script, removed scripts/perl directolry
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1722 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -441,7 +441,7 @@ sub addNodes_noChecking { | ||||
|         next; | ||||
|       } | ||||
|  | ||||
|       $result=`$::XCATROOT/bin/psh --nonodecheck $node /tmp/configrmcnode -a $node $ms_host_name $ms_ipaddresses 0x$ms_node_id 2>&1`; | ||||
|       $result=`$::XCATROOT/bin/psh --nonodecheck $node NODE=$node MASTER_NAME=$ms_host_name MASTER_IPS=$ms_ipaddresses MASTER_NODEID=0x$ms_node_id /tmp/configrmcnode 1 2>&1`; | ||||
|       if ($?) { | ||||
|         xCAT::MsgUtils->message('SI',  "[mon]: $result\n"); | ||||
|       } | ||||
| @@ -556,7 +556,7 @@ sub removeNodes_noChecking { | ||||
|         next; | ||||
|       } | ||||
|  | ||||
|       $result=`$::XCATROOT/bin/psh --nonodecheck $node /tmp/configrmcnode -d $node 2>&1`; | ||||
|       $result=`$::XCATROOT/bin/psh --nonodecheck $node NODE=$node /tmp/configrmcnode -1 2>&1`; | ||||
|       if ($?) { | ||||
|         xCAT::MsgUtils->message('SI', "[mon]: $result\n"); | ||||
|       } | ||||
|   | ||||
							
								
								
									
										57
									
								
								xCAT-rmc/scripts/configrmcnode
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								xCAT-rmc/scripts/configrmcnode
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| #!/bin/sh | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
|  | ||||
| use Getopt::Long; | ||||
|  | ||||
| ########################################################################################## | ||||
| # This script is used for RMC node configuration | ||||
| # usage: | ||||
| #  To add node to the cluster: | ||||
| #    NODE=nodename MASTER_NAME=msname \ | ||||
| #    MASTER_IPS={"9.114.46.26","..."} MASTER_NODEID=0xfbb5ec1f64dd299c \ | ||||
| #    configrmcnode 1     | ||||
| #  To remove node to the cluster  | ||||
| #    NODE=nodename configrmcnode -1 | ||||
| ##########################################################################################  | ||||
| ADD=$1; | ||||
|  | ||||
| logger xCAT "configrmcnode: ADD=$ADD, NODE=$NODE, MASTER_NAME=$MASTER_NAME, MASTER_IPS=$MASTER_IPS, MASTER_NODEID=$MASTER_NODEID" | ||||
|  | ||||
| #check if rsct is installed and running | ||||
| if [ ! -e /usr/bin/lsrsrc ]; then   | ||||
|   logger xCAT "RMC setup on node $NODE: RSCT is not is not installed." | ||||
|   exit 1; | ||||
| fi | ||||
|    | ||||
| PID=`/bin/ps -ef | /bin/grep rmcd | /bin/grep -v grep | /bin/awk '{print $2}'` | ||||
| if [ !$PID ]; then | ||||
|   #restart rmc daemon | ||||
|   result=`startsrc -s ctrmc 2>&1`; | ||||
|   if [ $? -gt 0 ]; then | ||||
|     logger xCAT "RMC deamon cannot be started on node $NODE:$result" | ||||
|     exit 1; | ||||
|   fi | ||||
| fi | ||||
|  | ||||
| #enable remote client connection | ||||
| /usr/bin/rmcctrl -p; /usr/bin/refrsrc IBM.MCP | ||||
|  | ||||
| if [ $ADD -eq 1 ]; then | ||||
|   #define resource in IBM.MCP class on node        | ||||
|   result1=`/usr/bin/mkrsrc-api IBM.MCP::MNName::"$NODE"::KeyToken::"$MASTER_NAME"::IPAddresses::"$MASTER_IPS"::NodeID::$MASTER_NODEID 2>&1` | ||||
|   if [ $? -gt 0 ]; then | ||||
|     logger xCAT  "Define resource in IBM.MCP class on node $NODE. result=$result1" }  | ||||
|     exit 1 | ||||
|   fi | ||||
|   #TODO: create predefined sensors | ||||
| else | ||||
|   #remove resource in IBM.MCP class on the node | ||||
|   result2= `/usr/bin/rmrsrc-api -s IBM.MCP::"MNName=\\\"\"$NODE\\\"\"" 2>&1` | ||||
|   if [ $? -gt 0 ]; then | ||||
|     logger xCAT "Remove resource in IBM.MCP class on noderesult=$result2" | ||||
|     exit 1 | ||||
|   fi | ||||
| fi | ||||
| exit 0; | ||||
|  | ||||
|  | ||||
| @@ -1,73 +0,0 @@ | ||||
| #!/usr/bin/env perl | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
|  | ||||
| use Getopt::Long; | ||||
|  | ||||
| ################################################################# | ||||
| # This script is used for RMC node configuration  | ||||
| ##################################################################  | ||||
| sub usage | ||||
| { | ||||
|   my %rsp; | ||||
|   print "Usage: | ||||
|      configrmcnode -a node_name ms_name ms_ip_addresses ms_node_id | ||||
|      configrmcnode -d node_name | ||||
|   "; | ||||
| } | ||||
|  | ||||
| print "configrmcnode get called\n"; | ||||
| if (!GetOptions( | ||||
|       'a'     => \$::ADD, | ||||
|       'd'  => \$::DELETE,)) { | ||||
|   &usage; | ||||
|   exit 1; | ||||
| } | ||||
|  | ||||
| if ($::ADD) { | ||||
|   if (@ARGV < 4) { | ||||
|     &usage; | ||||
|     exit 1;   | ||||
|   }  | ||||
|  | ||||
|   #check if rsct is installed and running | ||||
|   if (! -e "/usr/bin/lsrsrc") { | ||||
|     print "RSCT is not is not installed.\n"; | ||||
|     exit 1; | ||||
|   } | ||||
|   my $result=`/usr/bin/lssrc -s ctrmc`; | ||||
|   if ($result !~ /active/) { | ||||
|     #restart rmc daemon | ||||
|     $result=`startsrc -s ctrmc 2>&1`; | ||||
|     if ($?) { | ||||
|       print "rmc deamon cannot be started:$result\n"; | ||||
|       exit 1; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   #enable remote client connection | ||||
|   `/usr/bin/rmcctrl -p; /usr/bin/refrsrc IBM.MCP`; | ||||
|  | ||||
|   #define resource in IBM.MCP class on node        | ||||
|   $result=`/usr/bin/mkrsrc-api IBM.MCP::MNName::"$ARGV[0]"::KeyToken::"$ARGV[1]"::IPAddresses::"$ARGV[2]"::NodeID::$ARGV[3] 2>&1`; | ||||
|   if ($?) { print "define resource in IBM.MCP class result=$result\n"; }  | ||||
|  | ||||
|   #TODO: create predefined sensors. How does the scipts get on the node? mount? come with image? | ||||
|  | ||||
|   exit 0 | ||||
| } | ||||
|  | ||||
| if ($::DELETE) { | ||||
|   if (@ARGV < 1) { | ||||
|     &usage; | ||||
|     exit 1;   | ||||
|   }  | ||||
|  | ||||
|   #remove resource in IBM.MCP class on the node | ||||
|   my $result= `/usr/bin/rmrsrc-api -s IBM.MCP::"MNName=\\\"\"$ARGV[0]\\\"\"" 2>&1`; | ||||
|   if ($?) { print "remove resource in IBM.MCP class result=$result\n"; } | ||||
|  | ||||
|   #TODO: remove predefined sensors, | ||||
|    | ||||
|   exit 0; | ||||
| } | ||||
|  | ||||
| @@ -36,7 +36,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon | ||||
| cp plugin/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring | ||||
| cp -r resources $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/rmc | ||||
|  | ||||
| cp scripts/perl/* $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon | ||||
| cp scripts/* $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon | ||||
| chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon/* | ||||
|  | ||||
| %clean | ||||
|   | ||||
		Reference in New Issue
	
	Block a user