Misc updates to AIX postscripts
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2986 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
8f95428f89
commit
4e3fc2db8b
@ -146,9 +146,15 @@ sub setupAIXsn
|
||||
# `logger -t xcat $msg`;
|
||||
}
|
||||
|
||||
# set ulimit - so we can copy over large files - like spot
|
||||
if (&runcmd("/usr/bin/chuser fsize=-1 root") != 0) {
|
||||
$msg = "$::sdate servicenode: Could not change ulimit\n";
|
||||
`logger -t xcat $msg`;
|
||||
}
|
||||
|
||||
# do nim master setup - master fileset already installed
|
||||
if (&runcmd("nim_master_setup -a mk_resource=no") != 0) {
|
||||
$msg = "$::sdate servicenode: Could not run nim_master_setup.\n";
|
||||
if (&runcmd("/usr/sbin/nim_master_setup -a mk_resource=no") != 0) {
|
||||
$msg = "$::sdate servicenode: Could not run nim_master_setup.\n";
|
||||
`logger -t xcat $msg`;
|
||||
}
|
||||
|
||||
@ -246,6 +252,7 @@ sub getresponse
|
||||
my ($req) = @_;
|
||||
|
||||
my $port = "3001";
|
||||
my $node = $ENV{'NODE'};
|
||||
|
||||
# open listener connection to wait for check from management node
|
||||
my $lpid = &openlistener();
|
||||
@ -257,6 +264,21 @@ sub getresponse
|
||||
Proto => 'tcp',
|
||||
);
|
||||
|
||||
# try a few more times
|
||||
my $times=1;
|
||||
while (!$sock) {
|
||||
sleep(2);
|
||||
$times++;
|
||||
$sock = IO::Socket::SSL->new(
|
||||
PeerAddr => $::servnode,
|
||||
PeerPort => $port,
|
||||
Proto => 'tcp',
|
||||
);
|
||||
if ($times == 5) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($sock) {
|
||||
my $msg = "servicenode: Cannot connect to host \'$::servnode\'\n";
|
||||
`logger -t xcat $msg`;
|
||||
|
@ -4,10 +4,16 @@
|
||||
#
|
||||
# xCAT post script for AIX nodes
|
||||
#
|
||||
# This script is run from the /etc/inittab file on both
|
||||
# diskless and diskfull AIX nodes
|
||||
#
|
||||
# It is also run by the updatenode cmd
|
||||
#
|
||||
#####################################################
|
||||
|
||||
use File::Path;
|
||||
use IO::Socket;
|
||||
use Getopt::Long;
|
||||
|
||||
sleep int(rand(10));
|
||||
|
||||
@ -28,6 +34,14 @@ my $logfile = $logdir . "/xcat.log";
|
||||
open(LOGFILE,">>",$logfile);
|
||||
$::LOG_FILE = \*LOGFILE;
|
||||
|
||||
#
|
||||
# Process the command line...
|
||||
#
|
||||
if (!GetOptions('copy|c' => \$::opt_c,))
|
||||
{ # Gather options
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# get hostname
|
||||
$::shorthost = `hostname -s`;
|
||||
chomp $::shorthost;
|
||||
@ -62,40 +76,46 @@ if (-f "/etc/xcatinfo") {
|
||||
$servnode =~ s/^\s*//;
|
||||
chomp $servnode;
|
||||
|
||||
# create the xcatpost dir
|
||||
my $cmd = "mkdir -p /xcatpost";
|
||||
if (&runcmd($cmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not make the /xcatpost directory.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not make the /xcatpost directory.\n";
|
||||
}
|
||||
# if the /xcatpost dir has not been populated or the -c option is
|
||||
# specified then do the mount and copy of /install/postscripts
|
||||
if ( !(-f "/xcatpost/xcataixpost") || $::opt_c ) {
|
||||
# create the xcatpost dir
|
||||
my $cmd = "mkdir -p /xcatpost";
|
||||
if (&runcmd($cmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not make the /xcatpost directory.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not make the /xcatpost directory.\n";
|
||||
}
|
||||
|
||||
# get the contents of the /install/postscripts dir on the server
|
||||
# - mount dir from server and copy files
|
||||
my $mcmd = "mkdir -p /xcatmnt; mount $servnode:/install/postscripts /xcatmnt";
|
||||
if (&runcmd($mcmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not mount /install/postscripts from $servnode.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not mount /install/postscripts from $servnode.\n";
|
||||
}
|
||||
# get the contents of the /install/postscripts dir on the server
|
||||
# - mount dir from server and copy files
|
||||
my $mcmd = "mkdir -p /xcatmnt; mount $servnode:/install/postscripts /xcatmnt";
|
||||
if (&runcmd($mcmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not mount /install/postscripts from $servnode.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not mount /install/postscripts from $servnode.\n";
|
||||
}
|
||||
|
||||
my $cpcmd;
|
||||
if ((@ARGV==0) || ($ARGV[0] != 2)) {
|
||||
$cpcmd = "cp -r /xcatmnt/* /xcatpost 2>/dev/null";
|
||||
} else {
|
||||
# when argv[1]=2, there is only one postscript file,
|
||||
# user wants only download it to save time
|
||||
$cpcmd= "cp /xcatmnt/$ARGV[1] /xcatpost >/dev/null 2>&1";
|
||||
}
|
||||
my $cpcmd;
|
||||
if ((@ARGV==0) || ($ARGV[0] != 2)) {
|
||||
$cpcmd = "cp -r /xcatmnt/* /xcatpost 2>/dev/null";
|
||||
} else {
|
||||
# when argv[1]=2, there is only one postscript file,
|
||||
# user wants only download it to save time
|
||||
$cpcmd= "cp /xcatmnt/$ARGV[1] /xcatpost >/dev/null 2>&1";
|
||||
}
|
||||
|
||||
if (&runcmd($cpcmd) != 0) {
|
||||
# print "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
|
||||
# print $::LOG_FILE "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
|
||||
}
|
||||
if (&runcmd($cpcmd) != 0) {
|
||||
# print "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
|
||||
# print $::LOG_FILE "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
|
||||
}
|
||||
|
||||
my $ucmd = "umount /xcatmnt; rmdir /xcatmnt";
|
||||
if (&runcmd($ucmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not unmount /install.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not unmount /install/postscripts.\n";
|
||||
}
|
||||
|
||||
} # end recopy postscripts
|
||||
|
||||
my $ucmd = "umount /xcatmnt; rmdir /xcatmnt";
|
||||
if (&runcmd($ucmd) != 0) {
|
||||
print "$::sdate xcataixpost: Could not unmount /install.\n";
|
||||
print $::LOG_FILE "$::sdate xcataixpost: Could not unmount /install/postscripts.\n";
|
||||
}
|
||||
|
||||
# request the xCAT postscript for this particular node
|
||||
$scriptname = "/xcatpost/myxcatpost_" . $::shorthost;
|
||||
@ -206,7 +226,6 @@ sub getmypost {
|
||||
next;
|
||||
}
|
||||
print POSTSCRIPT "$line\n";
|
||||
#print "xcataixpost: line = \'$line\'\n";
|
||||
}
|
||||
close(POSTSCRIPT);
|
||||
close $remote;
|
||||
|
Loading…
Reference in New Issue
Block a user