diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 872993f3ec..8b2612c8f4 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -901,7 +901,8 @@ class ExecDriver < VirtualMachineDriver tm_rollback= xml_data.elements['TM_COMMAND_ROLLBACK'].text.strip # Build the process - if strategy == :live + case strategy + when :live tm_command_split = tm_command.split tm_command_split[0] += "_LIVE" @@ -913,38 +914,29 @@ class ExecDriver < VirtualMachineDriver :no_fail => true } ] - else - if strategy == :detach - pre_action = :detach_disk - pre_params = [:deploy_id, :disk_target_path, target, target_index] - - post_action = :attach_disk - post_params = [:deploy_id, :disk_target_path, target, target_index, - drv_message] - else # suspend - pre_action = :save - pre_params = [:deploy_id, :checkpoint_file, :host] - - post_action = :restore - post_params = [:checkpoint_file, :host, :deploy_id] - end + when :detach steps = [ + # detach_disk or save { :driver => :vmm, - :action => pre_action, - :parameters => pre_params + :action => :detach_disk, + :parameters => [:deploy_id, :disk_target_path, target, + target_index] }, + # run TM { :driver => :tm, :action => :tm_snap_create, :parameters => tm_command.split, :no_fail => true }, + # attach_disk or restore { :driver => :vmm, - :action => post_action, - :parameters => post_params, + :action => :attach_disk, + :parameters => [:deploy_id, :disk_target_path, target, + target_index, drv_message], :fail_actions => [ { :driver => :tm, @@ -954,6 +946,61 @@ class ExecDriver < VirtualMachineDriver ] } ] + when :suspend + steps = [ + # detach_disk or save + { + :driver => :vmm, + :action => :save, + :parameters => [:deploy_id, :checkpoint_file, :host] + }, + # network drivers (clean) + # network drivers (pre) + { + :driver => :vnm, + :action => :clean + }, + # run TM + { + :driver => :tm, + :action => :tm_snap_create, + :parameters => tm_command.split, + :no_fail => true + }, + # network drivers (pre) + { + :driver => :vnm, + :action => :pre + }, + # attach_disk or restore + { + :driver => :vmm, + :action => :restore, + :parameters => [:checkpoint_file, :host, :deploy_id], + :fail_actions => [ + { + :driver => :tm, + :action => :tm_snap_delete, + :parameters => tm_rollback.split + } + ] + }, + # network drivers (post) + { + :driver => :vnm, + :action => :post, + :parameters => [:deploy_id], + :fail_actions => [ + { + :driver => :vmm, + :action => :cancel, + :parameters => [:deploy_id, :host] + } + ] + } + ] + else + return end action.run(steps)