lib/vmpooler/providers/vsphere.rb
def create_snapshot(pool_name, vm_name, new_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?

            old_snap = find_snapshot(vm_object, new_snapshot_name)
            raise("Snapshot #{new_snapshot_name} for VM #{vm_name} in pool #{pool_name} already exists for the provider #{name}") unless old_snap.nil?

            vm_object.CreateSnapshot_Task(
              name: new_snapshot_name,
              description: 'vmpooler',
              memory: true,
              quiesce: true
            ).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 create_snapshot(pool_name, vm_name, new_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?
            old_snap = find_snapshot(vm_object, new_snapshot_name)
            raise("Snapshot #{new_snapshot_name} for VM #{vm_name} in pool #{pool_name} already exists for the provider #{name}") unless old_snap.nil?
            vm_object.CreateSnapshot_Task(
              name: new_snapshot_name,
              description: 'vmpooler',
              memory: true,
              quiesce: true
            ).wait_for_completion
          end
          true
        end
def create_snapshot ( pool_name , vm_name , new_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? old_snap = find_snapshot ( vm_object , new_snapshot_name ) raise ( "Snapshot #{new_snapshot_name} for VM #{vm_name} in pool #{pool_name} already exists for the provider #{name}" ) unless old_snap . nil? vm_object . CreateSnapshot_Task ( name : new_snapshot_name , description : 'vmpooler' , memory : true , quiesce : true ) . 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
new_snapshot_name