Sha256: e15c1febc6ed3fe16c5b02eea8b4fbfc524d971f6757a1d4a321222880495b2b

Contents?: true

Size: 1.15 KB

Versions: 45

Compression:

Stored size: 1.15 KB

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def vm_take_snapshot(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          raise ArgumentError, "name is a required parameter" unless options.key? 'name'
          vm = get_vm_ref(options['instance_uuid'])
          task = vm.CreateSnapshot_Task(
            :name => options['name'],
            :description => options['description'] || '',
            :memory => options['memory'] || true,
            :quiesce => options['quiesce'] || false
          )

          task.wait_for_completion

          {
            'task_state' => task.info.state,
            'was_cancelled' => task.info.cancelled
          }
        end
      end

      class Mock
        def vm_take_snapshot(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          raise ArgumentError, "name is a required parameter" unless options.key? 'name'
          {
            'task_state' => 'success',
            'was_cancelled' => false
          }
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
fog-vsphere-1.7.0.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-2.1.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-2.1.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-2.0.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-2.0.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.13.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.13.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.12.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.11.3 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.11.2 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.11.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.11.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.10.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.9.2 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.9.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.9.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.8.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.7.1 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.7.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
fog-vsphere-1.6.0 lib/fog/vsphere/requests/compute/vm_take_snapshot.rb