Sha256: ec0fb713c2a4e85c12ee772e928139ddca5d80eca3b721480bb724f3728a3497

Contents?: true

Size: 1.21 KB

Versions: 25

Compression:

Stored size: 1.21 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real
        def boot_from_snapshot(name, image_ref, flavor_ref, options = {})
          data = {
            'server' => {
              'flavorRef' => flavor_ref,
              'imageRef'  => image_ref,
              'name'      => name
            }
          }

          vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
                             'availability_zone', 'user_data', 'block_device_mapping',
                             'key_name', 'security_groups']
          vanilla_options.select { |o| options[o] }.each do |key|
            data['server'][key] = options[key]
          end

          if options['personality']
            data['server']['personality'] = []
            options['personality'].each do |file|
              data['server']['personality'] << {
                'contents' => Base64.encode64(file['contents']),
                'path'     => file['path']
              }
            end
          end

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200, 202],
            :method  => 'POST',
            :path    => '/os-volumes_boot'
          )
        end
      end
    end
  end
end

Version data entries

25 entries across 23 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.10 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.1.30 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.1.29 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.9 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.1.28 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.8 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.7 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.6 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.5 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.4 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.3 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.2 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.3.0 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.2.4 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.2.3 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.2.2 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.2.1 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-openstack-0.2.0 lib/fog/compute/openstack/requests/boot_from_snapshot.rb
fog-zj-0.1.28 lib/fog/compute/openstack/requests/boot_from_snapshot.rb