1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

feature #4716: pass timeout in OpenNebulaDriver

This commit is contained in:
Javi Fontan 2016-09-07 14:28:48 +02:00
parent 199d02bb29
commit 581269b0de

View File

@ -53,12 +53,14 @@ class OpenNebulaDriver < ActionManager
:concurrency => 10,
:threaded => true,
:retries => 0,
:local_actions => {}
:local_actions => {},
:timeout => nil
}.merge!(options)
super(@options[:concurrency], @options[:threaded])
@retries = @options[:retries]
@timeout = @options[:timeout]
#Set default values
initialize_helper(directory, @options)
@ -94,7 +96,11 @@ class OpenNebulaDriver < ActionManager
command = action_command_line(aname, params, options[:script_name])
if action_is_local?(aname)
execution = LocalCommand.run(command, log_method(id), Base64::encode64(options[:stdin].to_s.gsub("\n","")))
stdin = Base64::encode64(options[:stdin].to_s.gsub("\n",""))
execution = LocalCommand.run(command,
log_method(id),
stdin,
@timeout)
elsif options[:ssh_stream]
if options[:stdin]
cmdin = "cat << EOT | #{command}"
@ -104,15 +110,19 @@ class OpenNebulaDriver < ActionManager
stdin = nil
end
execution = options[:ssh_stream].run(cmdin, stdin, command)
execution = options[:ssh_stream].run(cmdin,
stdin,
command,
@timeout)
else
execution = RemotesCommand.run(command,
host,
@remote_scripts_base_path,
log_method(id),
options[:stdin],
@retries)
host,
@remote_scripts_base_path,
log_method(id),
options[:stdin],
@retries,
@timeout)
end
result, info = get_info_from_execution(execution)