Sha256: 020f0ca5e536aef030aa64ad1845a77a37587db9c823d2833b4b96842bebc840

Contents?: true

Size: 1.58 KB

Versions: 15

Compression:

Stored size: 1.58 KB

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def vm_reconfig_volumes(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          raise ArgumentError, "volumes is a required parameter" unless options.key? 'volumes'
          hardware_spec = {
            deviceChange: []
          }
          options['volumes'].each do |volume|
            hardware_spec[:deviceChange].push(create_disk(volume, :edit, filename: volume.filename))
          end
          vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
        end
      end

      class Mock
        def vm_reconfig_volumes(options = {})
          raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
          raise ArgumentError, "volumes is a required parameter" unless options.key? 'volumes'
          hardware_spec = {
            deviceChange: []
          }
          options['volumes'].each do |volume|
            hardware_spec[:deviceChange].push({
              :operation=>:edit,
              device: {
                backing: { diskMode: volume.mode, fileName: volume.filename },
                unitNumber: volume.unit_number,
                key: volume.key,
                controllerKey: volume.controller_key,
                capacityInKB: volume.size,
              }
            })
          end
          vm_reconfig_hardware('instance_uuid' => options['instance_uuid'], 'hardware_spec' => hardware_spec )
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fog-vsphere-2.1.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-2.1.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-2.0.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-2.0.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.13.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.13.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.12.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.11.3 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.11.2 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.11.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.11.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.10.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.9.2 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.9.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-1.9.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb