From ea407b5a67ad5b6cf81bc694bc819c9e4abcec41 Mon Sep 17 00:00:00 2001 From: Brandon Dunne Date: Thu, 8 Jan 2015 18:00:40 -0500 Subject: [PATCH] [Openstack] Update example for Servers.create with :block_device_mapping_v2 --- .../compute/block_device_mapping_v2.rb | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb b/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb index b3460a554..5d789c5d5 100644 --- a/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +++ b/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb @@ -8,23 +8,25 @@ username = 'admin@example.net' password = 'secret' tenant = 'My Compute Tenant' # String -compute_client ||= ::Fog::Compute.new(:provider => :openstack, - :openstack_api_key => password , - :openstack_username => username , - :openstack_auth_url => auth_url , - :openstack_tenant => tenant) +compute_client ||= ::Fog::Compute.new( + :provider => :openstack, + :openstack_api_key => password, + :openstack_username => username, + :openstack_auth_url => auth_url, + :openstack_tenant => tenant, +) -vm = compute_client.servers.create(:name => name, - :flavor_ref => flavor, - :block_device_mapping => [ - { - :api_ver => "v2", - :device_name => "/dev/vda1", - :source_type => "volume", - :destination_type => "volume", - :delete_on_termination => false, - :uuid => cinder_uddi, - :boot_index => 0 - } - ] - ) +vm = compute_client.servers.create( + :name => name, + :flavor_ref => flavor, + :block_device_mapping_v2 => [ + { + :boot_index => 0 + :device_name => "vda", + :source_type => "volume", # Or "snapshot" + :destination_type => "volume", + :delete_on_termination => false, + :uuid => cinder_uddi, + } + ] +)