remove what should have been a 2.9 checkin

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15092 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2013-02-07 12:38:51 +00:00
parent cbcb75cdb5
commit c24aadccfc
2 changed files with 103 additions and 165 deletions

View File

@ -224,8 +224,6 @@ sub preprocess_updatenode
'P|scripts:s' => \$::RERUNPS,
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
)
)
{
@ -927,14 +925,12 @@ sub updatenode
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
'F|sync' => \$::FILESYNC,
'l|user:s' => \$::USER,
'f|snsync' => \$::SNFILESYNC,
'S|sw' => \$::SWMAINTENANCE,
's|sn' => \$::SETSERVER,
'P|scripts:s' => \$::RERUNPS,
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
)
)
{
@ -1137,7 +1133,6 @@ sub updatenode
#-----------------------------------------------------------------------------
sub updatenoderunps
{
my $request = shift;
my $subreq = shift;
@ -1173,15 +1168,11 @@ sub updatenoderunps
# it's possible that the nodes could have diff server names
# do all the nodes for a particular server at once
foreach my $snkey (keys %servernodes)
{
my $nodestring = join(',', @{$servernodes{$snkey}});
my $args;
my $mode;
#now build the actual updatenode command
if ( $request->{rerunps4security}
&& $request->{rerunps4security}->[0] eq "yes")
{
@ -1201,25 +1192,35 @@ sub updatenoderunps
my $runpscmd;
if ($::SETSERVER){
$runpscmd =
"$installdir/postscripts/xcatdsklspost $mode -M $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c";
"$installdir/postscripts/xcatdsklspost $mode -M $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c ";
} else {
$runpscmd =
"$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"
"$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"
}
push @$args1,"--nodestatus"; # return nodestatus
if (defined($::fanout)) { # fanout
push @$args1,"-f" ;
push @$args1,$::fanout;
# if non-root userid ask xdsh to use sudo
if (defined($::USER)){ # non-root user
$args1 = [
"--nodestatus",
"--sudo",
"-s",
"-v",
"-e",
"$runpscmd"
];
} else { # running as root
$args1 = [
"--nodestatus",
"-s",
"-v",
"-e",
"$runpscmd"
];
}
# if -l username input
if (defined($::USER)){ # need to add the -l username
unshift(@$args1, "$::USER");
unshift(@$args1, "-l");
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
push @$args1,"$::USER" ;
}
push @$args1,"-s"; # streaming
push @$args1,"-v"; # streaming
push @$args1,"-e"; # execute
push @$args1,"$runpscmd"; # the command
if ($::VERBOSE)
@ -1330,39 +1331,33 @@ sub updatenodesyncfiles
foreach my $synclist (keys %syncfile_node)
{
$numberofsynclists++;
my $args;
my $env;
if ($request->{FileSyncing}->[0] ne "yes") { # sync SN only
push @$args,"-s" ;
$env = ["DSH_RSYNC_FILE=$synclist", "RSYNCSNONLY=1"];
} else {
$env = ["DSH_RSYNC_FILE=$synclist"];
}
push @$args,"--nodestatus" ;
if (defined($::fanout)) { # fanout
push @$args,"-f" ;
push @$args,$::fanout;
}
# if (defined($::USER)) { # -l contains sudo (TODO SUPPORT?)
# push @$args,"--sudo" ;
# push @$args,"-l" ;
# push @$args,"$::USER" ;
# }
push @$args,"-F" ;
push @$args,"$synclist" ;
my $nodestring = join(',', @{$syncfile_node{$synclist}});
if ($::VERBOSE)
{
my $rsp = {};
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdcp $nodestring " . join(' ', @$args);
if ($request->{FileSyncing}->[0] eq "yes")
{ # sync nodes
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdcp ". join(" ",@{$syncfile_node{$synclist}})." -F $synclist";
}
else
{ # sync SN
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdcp ".join(" ",@{$syncfile_node{$synclist}})." -s -F $synclist";
}
$callback->($rsp);
}
$CALLBACK = $callback;
my $args;
my $env;
if ($request->{FileSyncing}->[0] eq "yes")
{ # sync nodes
$args = ["--nodestatus","-F", "$synclist"];
$env = ["DSH_RSYNC_FILE=$synclist"];
}
else
{ # sync SN only
$args = ["-s", "--nodestatus","-F", "$synclist"];
$env = ["DSH_RSYNC_FILE=$synclist", "RSYNCSNONLY=1"];
}
$output =
xCAT::Utils->runxcmd(
{
@ -1526,24 +1521,30 @@ sub updatenodesoftware
$cmd =
"$installdir/postscripts/xcatdsklspost 2 -m $snkey 'ospkgs,otherpkgs' --tftp $tftpdir";
}
# build xdsh command
push @$args1,"--nodestatus"; # return nodestatus
if (defined($::fanout)) { # fanout
push @$args1,"-f" ;
push @$args1,$::fanout;
if (defined($::USER)){ # non-root user
$args1 = [
"--nodestatus",
"--sudo",
"-s",
"-v",
"-e",
"$cmd"
];
} else { # root
$args1 = [
"--nodestatus",
"-s",
"-v",
"-e",
"$cmd"
];
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
push @$args1,"$::USER" ;
# if -l username input
if (defined($::USER)){ # need to add the -l username
unshift(@$args1, "$::USER");
unshift(@$args1, "-l");
}
push @$args1,"-s"; # streaming
push @$args1,"-v"; # streaming
push @$args1,"-e"; # execute
push @$args1,"$cmd"; # the command
if ($::VERBOSE)
{
@ -2557,18 +2558,12 @@ sub updateAIXsoftware
}
else
{ # if server is remote then use xdsh
my $args;
if (defined($::fanout)) { # fanout input
push @$args,"-f" ;
push @$args,$::fanout;
}
push @$args,"$chmcmd";
my $output =
xCAT::Utils->runxcmd(
{
command => ["xdsh"],
node => [$serv],
arg => $args
arg => [$chmcmd]
},
$subreq, -1, 1
);
@ -2603,16 +2598,10 @@ sub updateAIXsoftware
push @{$rsp->{data}}, "Running command: $mcmd\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $args;
if (defined($::fanout)) { # fanout input
push @$args,"-f" ;
push @$args,$::fanout;
}
push @$args,"$mcmd";
my $output =
xCAT::Utils->runxcmd(
{command => ["xdsh"], node => \@nodes, arg => $args},
{command => ["xdsh"], node => \@nodes, arg => [$mcmd]},
$subreq, -1, 1);
if ($::RUNCMD_RC != 0)
@ -2706,21 +2695,20 @@ sub updateAIXsoftware
# installp - UNLESS the flags don't need filesets
if ($noinstallp == 0)
{
if ($::VERBOSE)
{
my $rsp;
push @{$rsp->{data}}, "Running: xdsh -s -v \'$inpcmd\'.\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $args1;
push @$args1,"--nodestatus";
push @$args1,"-s";
push @$args1,"-v";
if (defined($::fanout)) { # fanout input
push @$args1,"-f" ;
push @$args1,$::fanout;
}
push @$args1,"$inpcmd";
my $args1 = [
"--nodestatus",
"-s",
"-v",
"$inpcmd"
];
$subreq->(
{
@ -2746,18 +2734,12 @@ sub updateAIXsoftware
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $args;
if (defined($::fanout)) { # fanout input
push @$args,"-f" ;
push @$args,$::fanout;
}
push @$args,"$upcmd";
my $output =
xCAT::Utils->runxcmd(
{
command => ["xdsh"],
node => \@nodes,
arg => $args
arg => [$upcmd]
},
$subreq, -1, 1
);
@ -2823,19 +2805,13 @@ sub updateAIXsoftware
push @{$rsp->{data}}, "Running: \'$emgrcmd\'.\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $args;
if (defined($::fanout)) { # fanout input
push @$args,"-f" ;
push @$args,$::fanout;
}
push @$args,"$emgrcmd";
my $output =
xCAT::Utils->runxcmd(
{
command => ["xdsh"],
node => \@nodes,
arg => $args
arg => [$emgrcmd]
},
$subreq, -1, 1
);
@ -2930,15 +2906,12 @@ sub updateAIXsoftware
xCAT::MsgUtils->message("I", $rsp, $callback);
}
# install the rpms
my $args1;
push @$args1,"--nodestatus";
push @$args1,"-s";
push @$args1,"-v";
if (defined($::fanout)) { # fanout input
push @$args1,"-f" ;
push @$args1,$::fanout;
}
push @$args1,"$rcmd";
my $args1 = [
"--nodestatus",
"-s",
"-v",
"$rcmd"
];
$subreq->(
{
@ -2965,18 +2938,12 @@ sub updateAIXsoftware
xCAT::MsgUtils->message("I", $rsp, $callback);
}
my $args1;
if (defined($::fanout)) { # fanout input
push @$args1,"-f" ;
push @$args1,$::fanout;
}
push @$args1,"$ucmd";
my $output =
xCAT::Utils->runxcmd(
{
command => ["xdsh"],
node => \@nodes,
arg => $args1
arg => [$ucmd]
},
$subreq, -1, 1
);

View File

@ -101,10 +101,6 @@ sub preprocess_request
my @cmd = split(/ /, $value); # split off args, if any
$::dshexecute = $cmd[0]; # This is the executable file
}
if ($var eq "DSH_ENVIRONMENT") # from xdsh -E flag
{
$::dshenvfile = $value; # Name of file with env variables
}
}
# if xdcp need to make sure request has full path to input files
if ($command eq "xdcp") {
@ -158,9 +154,8 @@ sub preprocess_request
if (@snodes) # service nodes
{
# if xdcp and not pull function or xdsh -e or xdsh -E
if ((($command eq "xdcp") && ($::dcppull == 0)) or (($::dshexecute)
or ($::dshenvfile)))
# if xdcp and not pull function or xdsh -e
if ((($command eq "xdcp") && ($::dcppull == 0)) or ($::dshexecute))
{
# get the directory on the servicenode to put the files in
@ -186,7 +181,7 @@ sub preprocess_request
{
return;
}
} else { # xdsh -e or -E
} else { # xdsh -e
$rc =
&process_servicenodes_xdsh($req, $cb, $sub_req, \@snodes,
\@snoderange, $synfiledir);
@ -709,12 +704,10 @@ sub process_servicenodes_xdcp
#-------------------------------------------------------
=head3 process_servicenodes_xdsh
Build the xdsh command to sync the -e file or the -E file
to the servicenodes.
The executable (-e) or the environment file (-E)
must be copied into /var/xcat/syncfiles (SNsyncfiledir attribute), and then
the command modified so that the xdsh running on the SN will use the file
from /var/xcat/syncfiles (default) for the compute nodes.
Build the xdsh command to send the -e file
The executable must be copied into /var/xcat/syncfiles, and then
the command modified so that the xdsh running on the SN will cp the file
from /var/xcat/syncfiles to the compute node /tmp directory and run it.
Return an array of servicenodes that do not have errors
Returns error code:
if = 0, good return continue to process the
@ -739,52 +732,30 @@ sub process_servicenodes_xdsh
$::RUNCMD_RC = 0;
my $cmd = $req->{command}->[0];
# if xdsh -e <executable> command or xdsh -E <environment file>
# service nodes first need
# to be rsync with the executable or environment file to the $synfiledir
if (($::dshexecute) or ($::dshenvfile))
# if xdsh -e <executable> command, service nodes first need
# to be rsync with the executable file to the $synfiledir
if ($::dshexecute)
{
if (defined($::dshexecute) && (!-f $::dshexecute))
if (!-f $::dshexecute)
{ # -e file does not exist, quit
my $rsp = {};
$rsp->{error}->[0] = "File:$::dshexecute does not exist.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return (1); # process no service nodes
}
if (defined($::dshenvfile) && (!-f $::dshenvfile))
{ # -E file does not exist, quit
my $rsp = {};
$rsp->{error}->[0] = "File:$::dshenvfile does not exist.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return (1); # process no service nodes
}
# xdcp (-F) the executable from the xdsh -e and/or
# xdcp (-F) the environment file from the xdsh -E
# to the service node
# xdcp the executable from the xdsh -e to the service node first
# change noderange to the service nodes
# sync to each SN and check for error
# if error do not add to good_SN array, add to bad_SN
# /.../excutable -> $syncdir/..../executable
# /.../envfile -> $syncdir/...../envfile
# build a tmp syncfile with
# $::dshexecute -> $synfiledir . $::dshexecute
# $::dshenvfile -> $synfiledir . $::dshenvfile
my $tmpsyncfile = POSIX::tmpnam . ".dsh";
# if -E option
my $envfile;
my $execfile;
my $destination=$synfiledir . $::dshexecute;
open(TMPFILE, "> $tmpsyncfile")
or die "can not open file $tmpsyncfile";
if (defined($::dshenvfile)) {
$envfile=$synfiledir . $::dshenvfile;
print TMPFILE "$::dshenvfile -> $envfile\n";
}
if (defined($::dshexecute)) {
$execfile=$synfiledir . $::dshexecute;
print TMPFILE "$::dshexecute -> $execfile\n";
}
print TMPFILE "$::dshexecute -> $destination\n";
close TMPFILE;
chmod 0755, $tmpsyncfile;
@ -844,7 +815,7 @@ sub process_servicenodes_xdsh
# remove the tmp syncfile
`/bin/rm $tmpsyncfile`;
} # end xdsh -e or -E
} # end xdsh -E
# report bad service nodes]
if (@::bad_SN)