From 64073ff4d4d9b48fb41da97284a74b98484dd7d3 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 26 Feb 2008 19:57:57 +0000 Subject: [PATCH] Conserver Service Node plugin git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@587 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm diff --git a/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm new file mode 100644 index 000000000..67e37d208 --- /dev/null +++ b/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm @@ -0,0 +1,127 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +#------------------------------------------------------- +package xCAT_plugin::CONSsn; +use xCAT::Table; + +use xCAT::Utils; + +use xCAT::MsgUtils; +use Getopt::Long; + +#------------------------------------------------------- + +=head1 + xCAT plugin package to setup of nfs and mount /install + and /tfptboot + + +#------------------------------------------------------- + +=head3 handled_commands + +Check to see if on a Service Node +Check database to see if this node is going to have Conserver setup + should be always +Call setup_CONS + +=cut + +#------------------------------------------------------- + +sub handled_commands + +{ + my $rc = 0; + if (xCAT::Utils->isServiceNode()) + { + my @nodeinfo = xCAT::Utils->determinehostname; + my $nodename = $nodeinfo[0]; + my $nodeipaddr = $nodeinfo[1]; + my $service = "cons"; + $rc = xCAT::Utils->isServiceReq($nodename, $service, $nodeipaddr); + if ($rc == 1) + { + + # service needed on this Service Node + $rc = &setup_CONS($nodename); # setup CONS + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } + } + } + return $rc; +} + +#------------------------------------------------------- + +=head3 process_request + + Process the command + +=cut + +#------------------------------------------------------- +sub process_request +{ + return; +} + +#----------------------------------------------------------------------------- + +=head3 setup_CONS + + Sets up Conserver + +=cut + +#----------------------------------------------------------------------------- +sub setup_CONS +{ + my ($nodename) = @_; + my $rc = 0; + + # read DB for nodeinfo + my $master; + my $os; + my $arch; + my $cmd; + my $retdata = xCAT::Utils->readSNInfo($nodename); + if ($retdata->{'arch'}) + { # no error + $master = $retdata->{'master'}; + $os = $retdata->{'os'}; + $arch = $retdata->{'arch'}; + + # make the consever 8 configuration file + $cmd = "makeconservercf"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("S", "Error running $cmd"); + } + + # start conserver + my $cmd = "service conserver restart"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("S", "Error starting Conserver"); + return 1; + } + my $cmd = "chkconfig conserver on"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("S", "Error chkconfig conserver on"); + } + + } + else + { # error reading Db + $rc = 1; + } + return $rc; +} +1;