mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] Add blockDeviceMapping information to images
This commit is contained in:
parent
9696e21c71
commit
55e1d281e8
4 changed files with 27 additions and 13 deletions
|
@ -68,6 +68,7 @@ module Fog
|
|||
end
|
||||
{
|
||||
"imageOwnerId" => letters(rand(5) + 4),
|
||||
"blockDeviceMapping" => [],
|
||||
"productCodes" => [],
|
||||
"kernelId" => kernel_id,
|
||||
"ramdiskId" => ramdisk_id,
|
||||
|
|
|
@ -6,20 +6,21 @@ module Fog
|
|||
|
||||
class Image < Fog::Model
|
||||
|
||||
identity :id, 'imageId'
|
||||
identity :id, 'imageId'
|
||||
|
||||
attribute :architecture
|
||||
attribute :location, 'imageLocation'
|
||||
attribute :owner_id, 'imageOwnerId'
|
||||
attribute :state, 'imageState'
|
||||
attribute :type, 'imageType'
|
||||
attribute :is_public, 'isPublic'
|
||||
attribute :kernel_id, 'kernelId'
|
||||
attribute :block_device_mapping, 'blockDeviceMapping'
|
||||
attribute :location, 'imageLocation'
|
||||
attribute :owner_id, 'imageOwnerId'
|
||||
attribute :state, 'imageState'
|
||||
attribute :type, 'imageType'
|
||||
attribute :is_public, 'isPublic'
|
||||
attribute :kernel_id, 'kernelId'
|
||||
attribute :platform
|
||||
attribute :product_codes, 'productCodes'
|
||||
attribute :ramdisk_id, 'ramdiskId'
|
||||
attribute :root_device_type, 'rootDeviceType'
|
||||
attribute :root_device_name, 'rootDeviceName'
|
||||
attribute :product_codes, 'productCodes'
|
||||
attribute :ramdisk_id, 'ramdiskId'
|
||||
attribute :root_device_type, 'rootDeviceType'
|
||||
attribute :root_device_name, 'rootDeviceName'
|
||||
|
||||
def deregister
|
||||
connection.deregister_image(@id)
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class DescribeImages < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@image = { 'productCodes' => [] }
|
||||
@image = { 'productCodes' => [], 'blockDeviceMapping' => nil }
|
||||
@response = { 'imagesSet' => [] }
|
||||
end
|
||||
|
||||
|
@ -14,6 +14,11 @@ module Fog
|
|||
super
|
||||
if name == 'productCodes'
|
||||
@in_product_codes = true
|
||||
elsif name == 'blockDeviceMapping'
|
||||
@in_block_device_mapping = true
|
||||
@image['blockDeviceMapping'] = []
|
||||
elsif name == 'item' && @in_block_device_mapping
|
||||
@image['blockDeviceMapping'] << {}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,7 +33,8 @@ module Fog
|
|||
@image[name] = false
|
||||
end
|
||||
when 'item'
|
||||
unless @in_product_codes
|
||||
if @in_block_device_mapping
|
||||
elsif !@in_product_codes
|
||||
@response['imagesSet'] << @image
|
||||
@image = { 'productCodes' => [] }
|
||||
end
|
||||
|
@ -36,8 +42,13 @@ module Fog
|
|||
@image['productCodes'] << @value
|
||||
when 'productCodes'
|
||||
@in_product_codes = false
|
||||
when 'blockDeviceMapping'
|
||||
@in_block_device_mapping = false
|
||||
when 'requestId'
|
||||
@response[name] = @value
|
||||
when 'deviceName','virtualName','snapshotId','volumeSize','deleteOnTermination'
|
||||
l = @image['blockDeviceMapping'].length
|
||||
@image['blockDeviceMapping'][l-1].store(name,@value)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ module Fog
|
|||
# * 'requestId'<~String> - Id of request
|
||||
# * 'imagesSet'<~Array>:
|
||||
# * 'architecture'<~String> - Architecture of the image
|
||||
# * 'blockDeviceMapping'<~Array> - An array of mapped block devices
|
||||
# * 'imageId'<~String> - Id of the image
|
||||
# * 'imageLocation'<~String> - Location of the image
|
||||
# * 'imageOwnerId'<~String> - Id of the owner of the image
|
||||
|
|
Loading…
Reference in a new issue