add timeout support to updatenode to pass into xdsh

This commit is contained in:
lissav 2013-08-29 13:34:13 -04:00
parent f2ded51dec
commit bfbdb24622
3 changed files with 33 additions and 6 deletions

View File

@ -345,9 +345,9 @@ my %usage = (
"Usage:
updatenode [-h|--help|-v|--version | -g|--genmypost]
or
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn]
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn] [-t <timeout>]
or
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw]
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t <timeout>]
[-P|--scripts [script1,script2,...]] [-s|--sn]
[-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir]
[attr=val [attr=val...]]
@ -384,6 +384,9 @@ Options:
[-s|--sn] Set the server information stored on the nodes.
[-t|--timeout] Time out in seconds to allow the command to run. Default is no timeout,
except for updatenode -k which has a 10 second default timeout.
[-A|--updateallsw] Install or update all software contained in the source
directory. (AIX only)

View File

@ -88,7 +88,7 @@ if (
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
'F|sync' => \$::FILESYNC,
'g|genmypost' => \$::GENMYPOST,
'g|genmypost' => \$::GENMYPOST,
'f|snsync' => \$::SNFILESYNC,
'l|user:s' => \$::USER,
'S|sw' => \$::SWMAINTENANCE,
@ -97,6 +97,7 @@ if (
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
) {
&updatenode_usage();

View File

@ -227,6 +227,7 @@ sub preprocess_updatenode
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
)
@ -832,13 +833,18 @@ sub security_update_sshkeys
# call the xdsh -K to set up the ssh keys
my @envs = @{$request->{environment}};
my @args = ("-K");
my $args;
push @$args,"-K";
if (defined($::timeout)) { # timeout
push @$args,"-t" ;
push @$args,$::timeout;
}
my $res =
xCAT::Utils->runxcmd(
{
command => ['xdsh'],
node => \@$nodes,
arg => \@args,
arg => $args,
env => \@envs,
},
$subreq, 0, 1
@ -849,7 +855,7 @@ sub security_update_sshkeys
my $rsp = {};
# not display password in verbose mode.
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdsh -K. nodes = @$nodes, arguments = @args, env = xxxxxx";
" $localhostname: Internal call command: xdsh @$nodes " . join(' ', @$args);
$rsp->{data}->[1] =
" $localhostname: return messages of last command: @$res";
$callback->($rsp);
@ -1006,6 +1012,7 @@ sub updatenode
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
)
{
@ -1318,6 +1325,10 @@ sub updatenoderunps
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
@ -1450,6 +1461,10 @@ sub updatenodesyncfiles
push @$args,"-f" ;
push @$args,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args,"-t" ;
push @$args,$::timeout;
}
if (defined($::USER)) { # -l must sudo
push @$args,"--sudo" ;
push @$args,"-l" ;
@ -1646,6 +1661,10 @@ sub updatenodesoftware
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
@ -2622,6 +2641,10 @@ sub updateAIXsoftware
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
push @$args1,"$installcmd";
$subreq->(