From 49667756cb7a75d63e7be33f81febd0f20b39d7b Mon Sep 17 00:00:00 2001 From: sjing Date: Sat, 27 Apr 2013 06:04:50 +0000 Subject: [PATCH] Fix for bug 3538 - sometimes stopsrc -s named takes a longer time to take effect. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16094 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ddns.pm | 47 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 5159c0922..9ff2a3779 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -536,29 +536,7 @@ sub process_request { update_namedconf($ctx); update_zones($ctx); - - # check if named is active before update dns records. - if (xCAT::Utils->isAIX()) - { - my $cmd = "/usr/bin/lssrc -s $service |grep active"; - my @output=xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - system("/usr/bin/startsrc -s $service"); - xCAT::SvrUtils::sendmsg("Starting named complete", $callback); - } - } - else - { - my $cmd = "service $service status|grep running"; - my @output=xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - system("service $service start"); - xCAT::SvrUtils::sendmsg("Starting named complete", $callback); - } - } - + if ($ctx->{restartneeded}) { xCAT::SvrUtils::sendmsg("Restarting $service", $callback); @@ -579,6 +557,29 @@ sub process_request { xCAT::SvrUtils::sendmsg([1,"Unable to update DNS due to lack of credentials in passwd to communicate with remote server"], $callback); } } + + # check if named is active before update dns records. + if (xCAT::Utils->isAIX()) + { + my $cmd = "/usr/bin/lssrc -s $service |grep active"; + my @output=xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + system("/usr/bin/startsrc -s $service"); + xCAT::SvrUtils::sendmsg("Starting named complete", $callback); + } + } + else + { + my $cmd = "service $service status|grep running"; + my @output=xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + system("service $service start"); + xCAT::SvrUtils::sendmsg("Starting named complete", $callback); + } + } + #now we stick to Net::DNS style updates, with TSIG if possible. TODO: kerberized (i.e. Windows) DNS server support, maybe needing to use nsupdate -g.... if ($external) {