mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fixup!
This commit is contained in:
parent
492f8d2ca6
commit
a0ee50f963
2 changed files with 31 additions and 28 deletions
|
@ -16,12 +16,15 @@ compute_client ||= ::Fog::Compute.new(:provider => :openstack,
|
|||
|
||||
vm = compute_client.servers.create(:name => name,
|
||||
:flavor_ref => flavor,
|
||||
:block_device_mapping_v2 => [
|
||||
:device_name => "/dev/sda1",
|
||||
:source_type => "volume",
|
||||
:destination_type => "volume",
|
||||
:delete_on_termination => false,
|
||||
:uuid => cinder_uddi,
|
||||
:boot_index => 0
|
||||
: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
|
||||
}
|
||||
]
|
||||
)
|
||||
|
|
|
@ -58,28 +58,28 @@ module Fog
|
|||
end
|
||||
|
||||
if options['block_device_mapping']
|
||||
data['server']['block_device_mapping'] =
|
||||
[options['block_device_mapping']].flatten.map do |mapping|
|
||||
{
|
||||
'volume_size' => mapping[:volume_size],
|
||||
'volume_id' => mapping[:volume_id],
|
||||
'delete_on_termination' => mapping[:delete_on_termination],
|
||||
'device_name' => mapping[:device_name]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if options['block_device_mapping_v2']
|
||||
data['server']['block_device_mapping_v2'] =
|
||||
[options['block_device_mapping']].flatten.map do |mapping|
|
||||
{
|
||||
'device_name' => mapping[:device_name],
|
||||
'source_type' => mapping[:source_type],
|
||||
'destination_type' => mapping[:destination_type],
|
||||
'delete_on_termination' => mapping[:delete_on_termination],
|
||||
'uuid' => mapping[:uuid],
|
||||
'boot_index' => mapping[:boot_index]
|
||||
}
|
||||
if mapping[:api_ver] == "v2"
|
||||
data['server']['block_device_mapping_v2'] =
|
||||
[
|
||||
{
|
||||
'device_name' => mapping[:device_name],
|
||||
'source_type' => mapping[:source_type],
|
||||
'destination_type' => mapping[:destination_type],
|
||||
'delete_on_termination' => mapping[:delete_on_termination],
|
||||
'uuid' => mapping[:uuid],
|
||||
'boot_index' => mapping[:boot_index]
|
||||
}
|
||||
]
|
||||
else
|
||||
data['server']['block_device_mapping'] =
|
||||
{
|
||||
'volume_size' => mapping[:volume_size],
|
||||
'volume_id' => mapping[:volume_id],
|
||||
'delete_on_termination' => mapping[:delete_on_termination],
|
||||
'device_name' => mapping[:device_name]
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue