mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[Openstack|Compute|Server] Add test boot from block_device_mapping_v2
This commit is contained in:
parent
f771c752eb
commit
c55a2e27b9
2 changed files with 34 additions and 1 deletions
|
@ -156,7 +156,9 @@ module Fog
|
|||
}
|
||||
end
|
||||
|
||||
if block_device = options["block_device_mapping"]
|
||||
if block_devices = options["block_device_mapping_v2"]
|
||||
block_devices.each { |bd| compute.volumes.get(bd[:uuid]).attach(server_id, bd[:device_name]) }
|
||||
elsif block_device = options["block_device_mapping"]
|
||||
compute.volumes.get(block_device[:volume_id]).attach(server_id, block_device[:device_name])
|
||||
end
|
||||
|
||||
|
|
|
@ -74,6 +74,37 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do
|
|||
compute.servers.get(@server_id).volumes.first.id == @volume1_id
|
||||
end
|
||||
|
||||
#CREATE_SERVER_WITH_BLOCK_DEVICE_MAPPING_V2
|
||||
tests('#create_server("test", nil , #{@flavor_id}) with multiple block_device_mapping_v2').formats(@create_format, false) do
|
||||
@volume2_id = compute.create_volume('test', 'this is a test volume', 1).body["volume"]["id"]
|
||||
volume_data = [{
|
||||
:boot_index => 0,
|
||||
:uuid => @volume1_id,
|
||||
:device_name => "vda",
|
||||
:source_type => "volume",
|
||||
:destination_type => "volume",
|
||||
:delete_on_termination => true,
|
||||
}, {
|
||||
:boot_index => 1,
|
||||
:uuid => @volume2_id,
|
||||
:device_name => "vdb",
|
||||
:source_type => "volume",
|
||||
:destination_type => "volume",
|
||||
:delete_on_termination => true,
|
||||
}]
|
||||
data = compute.create_server("test", nil, @flavor_id, "block_device_mapping_v2" => volume_data).body['server']
|
||||
@server_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
tests("#get_server_details(#{@server_id})").formats(@base_server_format, false) do
|
||||
compute.get_server_details(@server_id).body['server']
|
||||
end
|
||||
|
||||
tests("#block_device_mapping_v2").succeeds do
|
||||
compute.servers.get(@server_id).volumes.collect(&:id).sort == [@volume1_id, @volume2_id].sort
|
||||
end
|
||||
|
||||
#CREATE_SINGLE_FROM_IMAGE
|
||||
tests('#create_server("test", #{@image_id} , 19)').formats(@create_format, false) do
|
||||
data = Fog::Compute[:openstack].create_server("test", @image_id, @flavor_id).body['server']
|
||||
|
|
Loading…
Reference in a new issue