mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-12 17:30:19 +00:00
add restart of daemon when xcatd starts in SN plugins
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@790 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
@ -14,8 +14,7 @@ use Getopt::Long;
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head1
|
||||
xCAT plugin package to setup of nfs and mount /install
|
||||
and /tfptboot
|
||||
xCAT plugin package to setup conserver
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
@ -53,6 +52,15 @@ sub handled_commands
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rc == 2)
|
||||
{ # already setup, just start the daemon
|
||||
# start conserver
|
||||
my $cmd = "/etc/rc.d/init.d/conserver start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@ -104,7 +112,7 @@ sub setup_CONS
|
||||
|
||||
my $modname = "conserver";
|
||||
${"xCAT_plugin::" . $modname . "::"}{process_request}
|
||||
->($cmdref,\&xCAT::Client::handle_response);
|
||||
->($cmdref, \&xCAT::Client::handle_response);
|
||||
my $cmd = "chkconfig conserver on";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
|
@ -50,6 +50,16 @@ sub handled_commands
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($rc == 2)
|
||||
{ # setup, just start the daemon
|
||||
$cmd = "/etc/rc.d/init.d/dhcpd start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@ -106,7 +116,7 @@ sub setup_DHCP
|
||||
|
||||
my $modname = "dhcp";
|
||||
${"xCAT_plugin::" . $modname . "::"}{process_request}
|
||||
->($cmdref,\&xCAT::Client::handle_response);
|
||||
->($cmdref, \&xCAT::Client::handle_response);
|
||||
|
||||
$cmd = "chkconfig dhcpd on";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
|
@ -33,8 +33,8 @@ sub handled_commands
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
my @nodeinfo = xCAT::Utils->determinehostname;
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $service = "nameservers";
|
||||
|
||||
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
|
||||
@ -42,12 +42,20 @@ sub handled_commands
|
||||
{
|
||||
|
||||
# service needed on this Service Node
|
||||
$rc = &setup_DNS($nodename); # setup DNS
|
||||
$rc = &setup_DNS($nodename); # setup DNS
|
||||
if ($rc == 0)
|
||||
{
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rc == 2)
|
||||
{ # service setup, just start the daemon
|
||||
$cmd = "service named start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@ -179,7 +187,14 @@ sub setup_DNS
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd");
|
||||
return 1;
|
||||
}
|
||||
$cmd = "/etc/rc.d/init.d/named restart";
|
||||
$cmd = "service named stop";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd");
|
||||
return 1;
|
||||
}
|
||||
$cmd = "service named start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
|
@ -36,20 +36,33 @@ sub handled_commands
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
my @nodeinfo = xCAT::Utils->determinehostname;
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $service = "nfsserver";
|
||||
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
|
||||
if ($rc == 1)
|
||||
{
|
||||
|
||||
# service needed on this Service Node
|
||||
$rc = &setup_NFS($nodename); # setup NFS
|
||||
$rc = &setup_NFS($nodename); # setup NFS
|
||||
if ($rc == 0)
|
||||
{
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rc == 2)
|
||||
{ # just start the daemon
|
||||
my $cmd = "service nfs start";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@ -152,8 +165,17 @@ sub setup_NFS
|
||||
xCAT::MsgUtils->message("S", "Error on command:$cmd");
|
||||
}
|
||||
|
||||
# make sure nfs is restarted
|
||||
my $cmd = "service nfs stop";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# make sure nfs is started
|
||||
my $cmd = "/etc/rc.d/init.d/nfs restart";
|
||||
my $cmd = "service nfs start";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
|
@ -12,7 +12,7 @@ use Getopt::Long;
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head1
|
||||
xCAT plugin package to setup of tftp
|
||||
xCAT plugin package to setup of atftp on both service node and MS
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
@ -31,26 +31,14 @@ sub handled_commands
|
||||
my $rc = 0;
|
||||
|
||||
# setup atftp
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
my @nodeinfo = xCAT::Utils->determinehostname;
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $service = "tftpserver";
|
||||
my $service = "tftpserver";
|
||||
|
||||
# check to see if service required
|
||||
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
|
||||
if ($rc != 1) # service not required
|
||||
$rc = &setup_TFTP(); # setup TFTP (ATFTP)
|
||||
if ($rc == 0)
|
||||
{
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
$rc = &setup_TFTP($nodename); # setup TFTP
|
||||
if ($rc == 0)
|
||||
{
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
xCAT::Utils->update_xCATSN($service);
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
@ -99,36 +87,29 @@ sub setup_TFTP
|
||||
{
|
||||
|
||||
# read DB for nodeinfo
|
||||
my $retdata = xCAT::Utils->readSNInfo($nodename);
|
||||
my @nodeinfo = xCAT::Utils->determinehostname;
|
||||
my $nodename = pop @nodeinfo; # get hostname
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $retdata = xCAT::Utils->readSNInfo($nodename);
|
||||
$master = $retdata->{'master'};
|
||||
$os = $retdata->{'os'};
|
||||
$arch = $retdata->{'arch'};
|
||||
if (!($arch))
|
||||
{ # error
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", " Error reading service node arch.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ # on MS
|
||||
if (-e "/etc/SuSE-release")
|
||||
{
|
||||
$os = "su";
|
||||
}
|
||||
else
|
||||
{
|
||||
$os = "rh";
|
||||
}
|
||||
}
|
||||
|
||||
# check to see if atftp is installed
|
||||
$cmd = "/usr/sbin/in.tftpd -V";
|
||||
my @output = xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # not installed
|
||||
{ # not installed
|
||||
xCAT::MsgUtils->message("S", "atftp is not installed");
|
||||
return 1;
|
||||
}
|
||||
if ($output[0] =~ "atftp") # it is atftp
|
||||
if ($output[0] =~ "atftp") # it is atftp
|
||||
{
|
||||
|
||||
# read tftp directory from database, if it exists
|
||||
@ -138,6 +119,8 @@ sub setup_TFTP
|
||||
$tftpdir = $tftpdir1[0];
|
||||
}
|
||||
mkdir($tftpdir);
|
||||
|
||||
# update fstab so that it will restart on reboot
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
$cmd =
|
||||
@ -150,41 +133,20 @@ sub setup_TFTP
|
||||
}
|
||||
}
|
||||
|
||||
if ($os =~ /su|sl/i) # sles
|
||||
# start atftp for both MS and Service node
|
||||
|
||||
$cmd = "service tftpd stop";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
|
||||
# setup atftp
|
||||
|
||||
$cmd = "service tftpd restart";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from command:$cmd");
|
||||
return 1;
|
||||
}
|
||||
xCAT::MsgUtils->message("S", "Error from command:$cmd");
|
||||
}
|
||||
else
|
||||
$cmd = "service tftpd start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
if ($os =~ /rh|fe/i) # redhat/fedora
|
||||
{
|
||||
|
||||
$cmd = "service tftpd restart";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from command:$cmd");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($os =~ /AIX/i)
|
||||
{
|
||||
|
||||
# TBD AIX
|
||||
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->message("S", "Error from command:$cmd");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user