Sha256: 4a18873850f9231efec128aed9f756564275901f3e7bb3b2795dbea7d7d878d6

Contents?: true

Size: 1.76 KB

Versions: 23

Compression:

Stored size: 1.76 KB

Contents

module Fog
  module Vsphere
    class Compute
      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

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.1.1 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-3.1.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
fog-vsphere-3.0.0 lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb