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:
commit
d4ef0983b4
1 changed files with 21 additions and 19 deletions
|
@ -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(
|
||||||
|
:name => name,
|
||||||
:flavor_ref => flavor,
|
:flavor_ref => flavor,
|
||||||
:block_device_mapping => [
|
:block_device_mapping_v2 => [
|
||||||
{
|
{
|
||||||
:api_ver => "v2",
|
:boot_index => 0
|
||||||
:device_name => "/dev/vda1",
|
:device_name => "vda",
|
||||||
:source_type => "volume",
|
:source_type => "volume", # Or "snapshot"
|
||||||
:destination_type => "volume",
|
:destination_type => "volume",
|
||||||
:delete_on_termination => false,
|
:delete_on_termination => false,
|
||||||
:uuid => cinder_uddi,
|
:uuid => cinder_uddi,
|
||||||
:boot_index => 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue