diff --git a/src/mad/ruby/ssh_stream.rb b/src/mad/ruby/ssh_stream.rb index 42ada93462..7c86bc474d 100644 --- a/src/mad/ruby/ssh_stream.rb +++ b/src/mad/ruby/ssh_stream.rb @@ -34,8 +34,9 @@ class SshStream # # # - def initialize(host) - @host = host + def initialize(host, shell="bash") + @host = host + @shell = shell end def opened? @@ -47,7 +48,7 @@ class SshStream end def open - @stdin, @stdout, @stderr=Open3::popen3("#{SSH_CMD} #{@host} bash -s ; echo #{SSH_RC_STR} $? 1>&2") + @stdin, @stdout, @stderr=Open3::popen3("#{SSH_CMD} #{@host} #{@shell} -s ; echo #{SSH_RC_STR} $? 1>&2") @stream_out = "" @stream_err = "" @@ -155,11 +156,11 @@ end class SshStreamCommand < RemotesCommand - def initialize(host, remote_dir, logger=nil, stdin=nil) + def initialize(host, remote_dir, logger=nil, stdin=nil, shell='bash') super('true', host, logger, stdin) @remote_dir = remote_dir - @stream = SshStream.new(host) + @stream = SshStream.new(host, shell) @stream.open end @@ -239,4 +240,4 @@ if $0 == __FILE__ lambda { |e| STDOUT.puts "error: #{e}" }, nil) cssh.run('whoami') -end \ No newline at end of file +end diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 2acc36e948..88c15d687a 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -150,6 +150,9 @@ class VmmAction ssh = @ssh_src end +puts get_parameters(step[:parameters]).inspect +puts ssh.inspect + result, info = @vmm.do_action(get_parameters(step[:parameters]), @id, host, @@ -241,6 +244,12 @@ class ExecDriver < VirtualMachineDriver :threaded => true }.merge!(options) + if options[:shell] + @shell=options[:shell] + else + @shell='bash' + end + super("vmm/#{hypervisor}", @options) @hypervisor = hypervisor @@ -256,7 +265,7 @@ class ExecDriver < VirtualMachineDriver if not action_is_local?(aname) stream = SshStreamCommand.new(host, @remote_scripts_base_path, - log_method(id)) + log_method(id), nil, @shell) else return nil end @@ -565,12 +574,14 @@ end opts = GetoptLong.new( [ '--retries', '-r', GetoptLong::OPTIONAL_ARGUMENT ], [ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ], - [ '--local', '-l', GetoptLong::REQUIRED_ARGUMENT ] + [ '--local', '-l', GetoptLong::REQUIRED_ARGUMENT ], + [ '--shell', '-s', GetoptLong::REQUIRED_ARGUMENT ] ) hypervisor = '' retries = 0 threads = 15 +shell = 'bash' local_actions = {} begin @@ -582,6 +593,8 @@ begin threads = arg.to_i when '--local' local_actions=OpenNebulaDriver.parse_actions_list(arg) + when '--shell' + shell = arg end end rescue Exception => e @@ -597,6 +610,7 @@ end exec_driver = ExecDriver.new(hypervisor, :concurrency => threads, :retries => retries, - :local_actions => local_actions) + :local_actions => local_actions, + :shell => shell) exec_driver.start_driver