Sha256: 79e18c90b2b4a698dcb5a9682f837e2f8b29ec7afe661ff35fd1c9d3a0229e05

Contents?: true

Size: 1.26 KB

Versions: 53

Compression:

Stored size: 1.26 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'] = []
            for file in options['personality']
              data['server']['personality'] << {
                'contents'  => Base64.encode64(file['contents']),
                'path'      => file['path']
              }
            end
          end

          request(
            :body     => MultiJson.encode(data),
            :expects  => [200, 202],
            :method   => 'POST',
            :path     => '/os-volumes_boot.json'
          )
        end
      end
    end # class OpenStack
  end # module Compute
end # module Fog

Version data entries

53 entries across 53 versions & 13 rubygems

Version Path
gapinc-fog-1.12.1.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
gapinc-fog-1.12.1a lib/fog/openstack/requests/compute/boot_from_snapshot.rb
gapinc-fog-1.12.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.12.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.12.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
hpfog-0.0.20 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-nirvanix-1.8.2 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-nirvanix-1.8.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.10.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-parser-fix-1.6.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-test-again-1.6.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-test-me-1.10.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-parser-fix-1.6.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
cifrado-0.1.3 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.10.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
cifrado-0.1.2 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
cifrado-0.1.1 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
cifrado-0.1 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb