1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #3386 from brandondunne/update_openstack_block_device_mapping_v2_example

[Openstack] Update example for Servers.create with :block_device_mapping_v2
This commit is contained in:
Wesley Beary 2015-01-09 10:00:13 -06:00
commit d4ef0983b4

View file

@ -8,23 +8,25 @@ username = 'admin@example.net'
password = 'secret' password = 'secret'
tenant = 'My Compute Tenant' # String tenant = 'My Compute Tenant' # String
compute_client ||= ::Fog::Compute.new(:provider => :openstack, compute_client ||= ::Fog::Compute.new(
:openstack_api_key => password , :provider => :openstack,
:openstack_username => username , :openstack_api_key => password,
:openstack_auth_url => auth_url , :openstack_username => username,
:openstack_tenant => tenant) :openstack_auth_url => auth_url,
:openstack_tenant => tenant,
)
vm = compute_client.servers.create(:name => name, vm = compute_client.servers.create(
:flavor_ref => flavor, :name => name,
:block_device_mapping => [ :flavor_ref => flavor,
{ :block_device_mapping_v2 => [
:api_ver => "v2", {
:device_name => "/dev/vda1", :boot_index => 0
:source_type => "volume", :device_name => "vda",
:destination_type => "volume", :source_type => "volume", # Or "snapshot"
:delete_on_termination => false, :destination_type => "volume",
:uuid => cinder_uddi, :delete_on_termination => false,
:boot_index => 0 :uuid => cinder_uddi,
} }
] ]
) )