lib/vmpooler/providers/vsphere.rb
def revert_snapshot(pool_name, vm_name, snapshot_name)
          @connection_pool.with_metrics do |pool_object|
            connection = ensured_vsphere_connection(pool_object)
            vm_object = find_vm(pool_name, vm_name, connection)
            raise("VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}") if vm_object.nil?

            snapshot_object = find_snapshot(vm_object, snapshot_name)
            raise("Snapshot #{snapshot_name} for VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}") if snapshot_object.nil?

            snapshot_object.RevertToSnapshot_Task.wait_for_completion
          end
          true
        end
# The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
def revert_snapshot(pool_name, vm_name, snapshot_name)
          @connection_pool.with_metrics do |pool_object|
            connection = ensured_vsphere_connection(pool_object)
            vm_object = find_vm(pool_name, vm_name, connection)
            raise("VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}") if vm_object.nil?
            snapshot_object = find_snapshot(vm_object, snapshot_name)
            raise("Snapshot #{snapshot_name} for VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}") if snapshot_object.nil?
            snapshot_object.RevertToSnapshot_Task.wait_for_completion
          end
          true
        end
def revert_snapshot ( pool_name , vm_name , snapshot_name ) @connection_pool . with_metrics do | pool_object | connection = ensured_vsphere_connection ( pool_object ) vm_object = find_vm ( pool_name , vm_name , connection ) raise ( "VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}" ) if vm_object . nil? snapshot_object = find_snapshot ( vm_object , snapshot_name ) raise ( "Snapshot #{snapshot_name} for VM #{vm_name} in pool #{pool_name} does not exist for the provider #{name}" ) if snapshot_object . nil? snapshot_object . RevertToSnapshot_Task . wait_for_completion end true end
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
pool_name
vm_name
snapshot_name