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
cifrado-0.2.1 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
cifrado-0.2.0 vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
gapinc-fog-1.12.1.2.1 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.18.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.17.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.16.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.15.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
gapinc-fog-1.14.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.14.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
fog-1.13.0 lib/fog/openstack/requests/compute/boot_from_snapshot.rb
gapinc-fog-1.12.1.2 lib/fog/openstack/requests/compute/boot_from_snapshot.rb