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

Bug: Do not start a ssh connection for local actions

This commit is contained in:
Ruben S. Montero 2011-12-16 23:20:30 +01:00
parent 004b1ab8f5
commit 2b96a92c65
2 changed files with 16 additions and 8 deletions

View File

@ -68,14 +68,14 @@ class VmmAction
get_data(:dest_driver, :MIGR_NET_DRV)
# Initialize streams and vnm
@ssh_src = @vmm.get_ssh_stream(@data[:host], @id)
@ssh_src = @vmm.get_ssh_stream(action, @data[:host], @id)
@vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
:local_actions => @vmm.options[:local_actions],
:message => @xml_data,
:ssh_stream => @ssh_src)
if @data[:dest_host] and !@data[:dest_host].empty?
@ssh_dst = @vmm.get_ssh_stream(@data[:dest_host], @id)
@ssh_dst = @vmm.get_ssh_stream(action, @data[:dest_host], @id)
@vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
:local_actions => @vmm.options[:local_actions],
:message => @xml_data,
@ -228,10 +228,16 @@ class ExecDriver < VirtualMachineDriver
# @param[String] the hostname of the host
# @param[String] id of the VM to log messages
# @return [SshStreamCommand]
def get_ssh_stream(host, id)
SshStreamCommand.new(host,
@remote_scripts_base_path,
log_method(id))
def get_ssh_stream(aname, host, id)
stream = nil
if not action_is_local?(aname)
stream = SshStreamCommand.new(host,
@remote_scripts_base_path,
log_method(id))
else
return nil
end
end
#---------------------------------------------------------------------------

View File

@ -58,7 +58,7 @@ class VirtualNetworkDriver
if action_is_local?(aname)
execution = LocalCommand.run(cmd, log_method(id))
else
elsif @ssh_stream != nil
if options[:stdin]
cmdin = "cat << EOT | #{cmd}"
stdin = "#{options[:stdin]}\nEOT\n"
@ -68,8 +68,10 @@ class VirtualNetworkDriver
end
execution = @ssh_stream.run(cmdin, stdin, cmd)
else
return RESULT[:failure], "Network action #{aname} needs a ssh stream."
end
result, info = get_info_from_execution(execution)
return get_info_from_execution(execution)
end
end