mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #863: Make use of action_info to pass extra parameters to net drivers
This commit is contained in:
parent
ce182b20e4
commit
dca599c5dc
@ -72,16 +72,14 @@ class VmmAction
|
||||
@vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
|
||||
:local_actions => @vmm.options[:local_actions],
|
||||
:message => @xml_data,
|
||||
:ssh_stream => @ssh_src,
|
||||
:extra_data => @data)
|
||||
:ssh_stream => @ssh_src)
|
||||
|
||||
if @data[:dest_host] and !@data[:dest_host].empty?
|
||||
@ssh_dst = @vmm.get_ssh_stream(@data[:dest_host], @id)
|
||||
@vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
|
||||
:local_actions => @vmm.options[:local_actions],
|
||||
:message => @xml_data,
|
||||
:ssh_stream => @ssh_dst,
|
||||
:extra_data => @data)
|
||||
:ssh_stream => @ssh_dst)
|
||||
end
|
||||
end
|
||||
|
||||
@ -149,7 +147,8 @@ class VmmAction
|
||||
vnm = @vnm_src
|
||||
end
|
||||
|
||||
result, info = vnm.do_action(@id, step[:action])
|
||||
result, info = vnm.do_action(@id, step[:action],
|
||||
:parameters => get_parameters(step[:parameters]))
|
||||
else
|
||||
result = DriverExecHelper.const_get(:RESULT)[:failure]
|
||||
info = "No driver in #{step[:action]}"
|
||||
@ -157,7 +156,6 @@ class VmmAction
|
||||
|
||||
# Save the step info
|
||||
@data["#{step[:action]}_info".to_sym] = info
|
||||
@data[step[:save_info_as]] = info if step[:save_info_as]
|
||||
|
||||
# Roll back steps, store failed info and break steps
|
||||
if DriverExecHelper.failed?(result)
|
||||
@ -280,12 +278,12 @@ class ExecDriver < VirtualMachineDriver
|
||||
:action => :deploy,
|
||||
:parameters => [dfile, :host],
|
||||
:stdin => domain,
|
||||
:save_info_as => :deploy_id
|
||||
},
|
||||
# Execute post-boot networking setup
|
||||
{
|
||||
:driver => :vnm,
|
||||
:action => :post,
|
||||
:parameters => [:deploy_info]
|
||||
:fail_actions => [
|
||||
{
|
||||
:driver => :vmm,
|
||||
@ -496,5 +494,3 @@ exec_driver = ExecDriver.new(hypervisor,
|
||||
:local_actions => local_actions)
|
||||
|
||||
exec_driver.start_driver
|
||||
|
||||
|
||||
|
@ -31,7 +31,6 @@ class VirtualNetworkDriver
|
||||
@options = options
|
||||
@ssh_stream = options[:ssh_stream]
|
||||
@message = options[:message]
|
||||
@extra_data = options[:extra_data]
|
||||
|
||||
@vm_encoded = Base64.encode64(@message.elements['VM'].to_s).delete("\n")
|
||||
|
||||
@ -45,14 +44,17 @@ class VirtualNetworkDriver
|
||||
# @param [String, Symbol] aname name of the action
|
||||
# @param [Hash] ops extra options for the command
|
||||
# @option ops [String] :stdin text to be writen to stdin
|
||||
# @option ops [String] :parameters additional parameters for vnm action
|
||||
def do_action(id, aname, ops = {})
|
||||
options={
|
||||
:stdin => nil,
|
||||
:stdin => nil,
|
||||
:parameters => nil
|
||||
}.merge(ops)
|
||||
|
||||
deploy_id=@extra_data[:deploy_id] || '-'
|
||||
cmd_params = "#{@vm_encoded}"
|
||||
cmd_params << " #{options[:parameters]}" if options[:parameters]
|
||||
|
||||
cmd = action_command_line(aname, "#{@vm_encoded} #{deploy_id}")
|
||||
cmd = action_command_line(aname, cmd_params)
|
||||
|
||||
if action_is_local?(aname)
|
||||
execution = LocalCommand.run(cmd, log_method(id))
|
||||
|
Loading…
x
Reference in New Issue
Block a user