From d6cc5bc2c8fea0a38e28755c79db1761237a5c2d Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 1 Mar 2016 15:05:19 +0100 Subject: [PATCH] feature #4215: support reconf without tm action in vmm_exec --- src/vmm_mad/exec/one_vmm_exec.rb | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index ce3e9c1daf..51929964b4 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -796,11 +796,12 @@ class ExecDriver < VirtualMachineDriver action = ACTION[:attach_nic] xml_data = decode(drv_message) - tm_command = ensure_xpath(xml_data, id, action, 'TM_COMMAND') || return - target_path = ensure_xpath(xml_data, id, action, - 'DISK_TARGET_PATH') || return - target_device = ensure_xpath(xml_data, id, action, - 'VM/TEMPLATE/CONTEXT/TARGET') || return + tm_command = xml_data.elements['TM_COMMAND'] + tm_command = tm_command.text if tm_command + target_path = xml_data.elements['DISK_TARGET_PATH'] + target_path = target_path.text if target_path + target_device = xml_data.elements['VM/TEMPLATE/CONTEXT/TARGET'] + target_device = target_device.text if target_device begin source = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/BRIDGE"] @@ -863,19 +864,26 @@ class ExecDriver < VirtualMachineDriver :driver => :vmm, :action => :prereconfigure, :parameters => [:deploy_id, target_device] - }, - { - :driver => :tm, - :action => :tm_context, - :parameters => tm_command.split - }, - { - :driver => :vmm, - :action => :reconfigure, - :parameters => [:deploy_id, target_device, target_path] } ] + if tm_command && !tm_command.empty? + steps << { + :driver => :tm, + :action => :tm_context, + :parameters => tm_command.strip.split(' ') + } + end + + steps << { + :driver => :vmm, + :action => :reconfigure, + :parameters => [:deploy_id, target_device, target_path] + } + + STDERR.puts "TM_COMMAND" + STDERR.puts tm_command.inspect + action.run(steps) end