Method: Lab::Drivers::RemoteEsxiDriver#revert_snapshot

Defined in:
lib/lab/driver/remote_esxi_driver.rb

#revert_snapshot(snapshot) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lab/driver/remote_esxi_driver.rb', line 60

def revert_snapshot(snapshot)

  snapshots = get_snapshots
  
  # Look through our snapshot list, choose the right one based on display_name    
  snapshots.each do |snapshot_obj|
  
    #puts "DEBUG: checking #{snapshot_obj}"
  
    if snapshot_obj[:display_name].downcase == snapshot.downcase
      snapshot_identifier = snapshot_obj[:name].join(" ")
      
      #puts "DEBUG: I would revert to #{snapshot_obj}"
      remote_system_command("vim-cmd vmsvc/snapshot.revert #{@vmid} 0 #{snapshot_identifier}")
      return true
    end
  end

  # If we got here, we couldn't make it happen
  raise "Unable to revert"
end