mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add boot_volume_size to RS compute_v2 Server Create
Keeps the default value to 100GB but allows specifying other sizes
This commit is contained in:
parent
803d46791f
commit
9498313741
2 changed files with 13 additions and 2 deletions
|
@ -153,6 +153,11 @@ module Fog
|
||||||
# @see http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot
|
# @see http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot
|
||||||
attribute :boot_volume_id
|
attribute :boot_volume_id
|
||||||
|
|
||||||
|
# @!attribute [w] boot_volume_size
|
||||||
|
# @return [Integer] The Size of the boot volume to be created by the BlockStorage service.
|
||||||
|
# @see http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot
|
||||||
|
attribute :boot_volume_size
|
||||||
|
|
||||||
# @!attribute [w] boot_image_id
|
# @!attribute [w] boot_image_id
|
||||||
# @return [String] The ID of an image to create a bootable volume from.
|
# @return [String] The ID of an image to create a bootable volume from.
|
||||||
# @see http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot
|
# @see http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot
|
||||||
|
@ -264,6 +269,7 @@ module Fog
|
||||||
modified_options[:key_name] ||= attributes[:key_name]
|
modified_options[:key_name] ||= attributes[:key_name]
|
||||||
modified_options[:boot_volume_id] ||= attributes[:boot_volume_id]
|
modified_options[:boot_volume_id] ||= attributes[:boot_volume_id]
|
||||||
modified_options[:boot_image_id] ||= attributes[:boot_image_id]
|
modified_options[:boot_image_id] ||= attributes[:boot_image_id]
|
||||||
|
modified_options[:boot_volume_size] ||= attributes[:boot_volume_size]
|
||||||
|
|
||||||
if modified_options[:networks]
|
if modified_options[:networks]
|
||||||
modified_options[:networks].map! { |id| { :uuid => id } }
|
modified_options[:networks].map! { |id| { :uuid => id } }
|
||||||
|
|
|
@ -18,6 +18,7 @@ module Fog
|
||||||
# attachment of volumes to this server. Mutually exclusive with :volume_id or :volume_image_id. If provided, leave image_id
|
# attachment of volumes to this server. Mutually exclusive with :volume_id or :volume_image_id. If provided, leave image_id
|
||||||
# as "". See http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot for details.
|
# as "". See http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot for details.
|
||||||
# @option options [String] boot_volume_id Id of a pre-created bootable volume to use for this server. If provided, leave image_id as "".
|
# @option options [String] boot_volume_id Id of a pre-created bootable volume to use for this server. If provided, leave image_id as "".
|
||||||
|
# @option options [Integer] boot_volume_size Size of the bootable volume to be created expressed in GB. (defaults to 100)
|
||||||
# @option options [String] boot_image_id Id of an image to create a bootable volume from and attach to this server. If provided,
|
# @option options [String] boot_image_id Id of an image to create a bootable volume from and attach to this server. If provided,
|
||||||
# leave image_id as "".
|
# leave image_id as "".
|
||||||
# @return [Excon::Response] response:
|
# @return [Excon::Response] response:
|
||||||
|
@ -96,12 +97,16 @@ module Fog
|
||||||
Fog::Logger.warning(":boot_volume_id overrides :boot_image_id!")
|
Fog::Logger.warning(":boot_volume_id overrides :boot_image_id!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options[:boot_volume_size]
|
||||||
|
Fog::Logger.warning("Boot volume size: " + options[:boot_volume_size] + "GB")
|
||||||
|
end
|
||||||
|
|
||||||
data['server']['block_device_mapping_v2'] = [{
|
data['server']['block_device_mapping_v2'] = [{
|
||||||
'boot_index' => '0',
|
'boot_index' => '0',
|
||||||
'uuid' => options[:boot_volume_id],
|
'uuid' => options[:boot_volume_id],
|
||||||
'source_type' => 'volume',
|
'source_type' => 'volume',
|
||||||
'destination_type' => 'volume',
|
'destination_type' => 'volume',
|
||||||
'volume_size' => 100
|
'volume_size' => options[:boot_volume_size] ? options[:boot_volume_size] : 100
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,7 +116,7 @@ module Fog
|
||||||
'uuid' => options[:boot_image_id],
|
'uuid' => options[:boot_image_id],
|
||||||
'source_type' => 'image',
|
'source_type' => 'image',
|
||||||
'destination_type' => 'volume',
|
'destination_type' => 'volume',
|
||||||
'volume_size' => 100
|
'volume_size' => options[:boot_volume_size] ? options[:boot_volume_size] : 100
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue