From 7c579002562e6a92b9ab5dde91864ca2c6982c35 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 26 Feb 2008 13:50:39 +0000 Subject: [PATCH] Fix check for already setup git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@575 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm | 5 ++++- xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm | 9 ++++++--- xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm | 17 +++++++++++++---- xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm | 12 +++++++----- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm b/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm index d92a54d93..9d78d9e2c 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm @@ -43,6 +43,10 @@ sub handled_commands # service needed on this Service Node $rc = &setup_DHCP($nodename); # setup DHCP + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } } } return $rc; @@ -113,7 +117,6 @@ sub setup_DHCP { # error reading Db $rc = 1; } - xCAT::Utils->update_xCATSN("dhcp"); return $rc; } 1; diff --git a/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm index be85985af..723aba429 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm @@ -29,7 +29,7 @@ Call setup_DNS sub handled_commands { - my $rc=0; + my $rc = 0; if (xCAT::Utils->isServiceNode()) { my @nodeinfo = xCAT::Utils->determinehostname; @@ -43,6 +43,10 @@ sub handled_commands # service needed on this Service Node $rc = &setup_DNS($nodename); # setup DNS + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } } } return $rc; @@ -166,11 +170,10 @@ sub setup_DNS `cp /etc/named.conf /var/named/chroot/etc`; `chkconfig --level 345 named on`; `service named restart`; - xCAT::Utils->update_xCATSN("dns"); } } else - { # error reading DB + { # error reading DB return 1; } return 0; diff --git a/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm index ade9d7b85..c28b75182 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm @@ -21,7 +21,8 @@ use Getopt::Long; =head3 handled_commands Check to see if on a Service Node -This will be setup all the time on Service Nodes +Check database to see if this node is a NFS server + should be always Call setup_NFS =cut @@ -37,9 +38,18 @@ sub handled_commands my @nodeinfo = xCAT::Utils->determinehostname; my $nodename = $nodeinfo[0]; my $nodeipaddr = $nodeinfo[1]; + 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 + # service needed on this Service Node + $rc = &setup_NFS($nodename); # setup NFS + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } + } } return $rc; } @@ -220,7 +230,6 @@ sub setup_NFS { `echo "$master:$installdir $installdir nfs timeo=14,intr 1 2" >>/etc/fstab`; } - xCAT::Utils->update_xCATSN("nfs"); } return $rc; } diff --git a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm index 284b14cf9..fdaebe55e 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm @@ -42,7 +42,11 @@ sub handled_commands { # service needed on this Service Node - $rc=&setup_TFTP($nodename); # setup TFTP + $rc = &setup_TFTP($nodename); # setup TFTP + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } } } return $rc; @@ -104,8 +108,7 @@ sub setup_TFTP if (xCAT::Utils->isLinux()) { - # enable tftp - + # enable tftp my $cmd = "chkconfig tftp on"; xCAT::Utils->runcmd($cmd, -1); @@ -129,7 +132,6 @@ sub setup_TFTP # TBD AIX tftp may already be enabled } - xCAT::Utils->update_xCATSN("tftp"); - return 0; + return 0; } 1;