Method: Lab::Drivers::RemoteEsxiDriver#delete_snapshot

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

#delete_snapshot(snapshot, remove_children = false) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/lab/driver/remote_esxi_driver.rb', line 82

def delete_snapshot(snapshot, remove_children=false)
  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(" ")
      remote_system_command("vim-cmd vmsvc/snapshot.remove #{@vmid} #{remove_children} #{snapshot_identifier}")
      return true
    end
  end

  # If we got here, the snapshot didn't exist
  raise "Invalid Snapshot Name"
end