Revision 0084ffc5 src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
2172 2172
    # Create a snapshot for the VM
2173 2173
    def create_snapshot(snap_id, snap_name)
2174 2174
        snapshot_hash = {
2175
            :name        => snap_name,
2176
            :description => "OpenNebula's snapshot at #{Time.now}",
2175
            :name        => snap_id,
2176
            :description => "OpenNebula Snapshot: #{snap_name}",
2177 2177
            :memory      => true,
2178 2178
            :quiesce     => true
2179 2179
        }
......
2211 2211
    end
2212 2212

  
2213 2213
    # Revert to a VM snapshot
2214
    def revert_snapshot(snap_id, snap_name)
2214
    def revert_snapshot(snap_id)
2215 2215

  
2216 2216
        snapshot_list = self["snapshot.rootSnapshotList"]
2217
        snapshot = find_snapshot_in_list(snapshot_list, snap_id, snap_name)
2217
        snapshot = find_snapshot_in_list(snapshot_list, snap_id)
2218 2218

  
2219 2219
        return nil if !snapshot
2220 2220

  
......
2227 2227
    end
2228 2228

  
2229 2229
    # Delete VM snapshot
2230
    def delete_snapshot(snap_id, snap_name)
2230
    def delete_snapshot(snap_id)
2231 2231

  
2232 2232
        snapshot_list = self["snapshot.rootSnapshotList"]
2233
        snapshot = find_snapshot_in_list(snapshot_list, snap_id, snap_name)
2233
        snapshot = find_snapshot_in_list(snapshot_list, snap_id)
2234 2234

  
2235 2235
        return nil if !snapshot
2236 2236

  
......
2245 2245
        end
2246 2246
    end
2247 2247

  
2248
    def find_snapshot_in_list(list, snap_id, snap_name)
2248
    def find_snapshot_in_list(list, snap_id)
2249 2249
        list.each do |i|
2250
            if i.name == snap_id.to_s || i.name == snap_name.to_s
2250
            if i.name == snap_id.to_s
2251 2251
                return i.snapshot
2252 2252
            elsif !i.childSnapshotList.empty?
2253
                snap = find_snapshot_in_list(i.childSnapshotList, snap_id, snap_name)
2253
                snap = find_snapshot_in_list(i.childSnapshotList, snap_id)
2254 2254
                return snap if snap
2255 2255
            end
2256 2256
        end rescue nil

Also available in: Unified diff