[Openstack] Update example for Servers.create with :block_device_mapping_v2

This commit is contained in:
Brandon Dunne 2015-01-08 18:00:40 -05:00
parent 9815cc86f1
commit ea407b5a67
1 changed files with 21 additions and 19 deletions

View File

@ -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,
}
]
)