From 8b90088bf9d7c0babc7f6fd1031098dd6d6bb3db Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 14 May 2012 08:57:20 +0000 Subject: [PATCH] defect 3525895: check the status of xcatd before continuing in the xcatconfig git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12661 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 19de64d00..e321c0dc0 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -368,6 +368,9 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL || $::genCredentials) system($xcmd); } +# wait for the starting of xcatd +&waitxcatd; + # more config needed after xcatd start if ($::INITIALINSTALL || $::FORCE) { @@ -1697,6 +1700,31 @@ sub mknb } +#----------------------------------------------------------------------------- +=head3 waitxcatd + + Wait xcatd to function after the restart of xcatd + +=cut +#----------------------------------------------------------------------------- +sub waitxcatd { + my $cmd = "$::XCATROOT/bin/nodels -v"; + my $n = 0; + while ($n++ < 10) { + sleep 1; + my $output = xCAT::Utils->runcmd("$cmd", -1); + if ($::RUNCMD_RC == 0 || $output =~ /Version/) { + last; + } else { + next; + } + } + + if ($n >= 10) { + print "Failed to check the status of xcatd\n"; + } +} + #----------------------------------------------------------------------------- =head3 makenetworks