diff --git a/xCAT-rmc/plugin/rmcmon.pm b/xCAT-rmc/plugin/rmcmon.pm index 9ae2bf29b..ced5c1140 100644 --- a/xCAT-rmc/plugin/rmcmon.pm +++ b/xCAT-rmc/plugin/rmcmon.pm @@ -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"); } diff --git a/xCAT-rmc/scripts/configrmcnode b/xCAT-rmc/scripts/configrmcnode new file mode 100755 index 000000000..d9cfdfd2d --- /dev/null +++ b/xCAT-rmc/scripts/configrmcnode @@ -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; + + diff --git a/xCAT-rmc/scripts/perl/email-hierarchical-event b/xCAT-rmc/scripts/email-hierarchical-event similarity index 100% rename from xCAT-rmc/scripts/perl/email-hierarchical-event rename to xCAT-rmc/scripts/email-hierarchical-event diff --git a/xCAT-rmc/scripts/perl/errmsgque b/xCAT-rmc/scripts/errmsgque similarity index 100% rename from xCAT-rmc/scripts/perl/errmsgque rename to xCAT-rmc/scripts/errmsgque diff --git a/xCAT-rmc/scripts/perl/mkrmcresources b/xCAT-rmc/scripts/mkrmcresources similarity index 100% rename from xCAT-rmc/scripts/perl/mkrmcresources rename to xCAT-rmc/scripts/mkrmcresources diff --git a/xCAT-rmc/scripts/perl/monerrorlog b/xCAT-rmc/scripts/monerrorlog similarity index 100% rename from xCAT-rmc/scripts/perl/monerrorlog rename to xCAT-rmc/scripts/monerrorlog diff --git a/xCAT-rmc/scripts/perl/msg-hierarchical-event b/xCAT-rmc/scripts/msg-hierarchical-event similarity index 100% rename from xCAT-rmc/scripts/perl/msg-hierarchical-event rename to xCAT-rmc/scripts/msg-hierarchical-event diff --git a/xCAT-rmc/scripts/perl/mtime b/xCAT-rmc/scripts/mtime similarity index 100% rename from xCAT-rmc/scripts/perl/mtime rename to xCAT-rmc/scripts/mtime diff --git a/xCAT-rmc/scripts/perl/configrmcnode b/xCAT-rmc/scripts/perl/configrmcnode deleted file mode 100755 index 0e586bbf6..000000000 --- a/xCAT-rmc/scripts/perl/configrmcnode +++ /dev/null @@ -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; -} - diff --git a/xCAT-rmc/xCAT-rmc.spec b/xCAT-rmc/xCAT-rmc.spec index 95fad3fda..666af01a4 100644 --- a/xCAT-rmc/xCAT-rmc.spec +++ b/xCAT-rmc/xCAT-rmc.spec @@ -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