mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add code to accept config_drive and block_device_mapping parameters while creating a server instance.
This commit is contained in:
parent
d4feba66df
commit
6fc3043a2f
2 changed files with 12 additions and 1 deletions
|
@ -26,6 +26,7 @@ module Fog
|
|||
attribute :user_id
|
||||
attribute :key_name
|
||||
attribute :security_groups
|
||||
attribute :config_drive
|
||||
# these are implemented as methods
|
||||
attribute :image_id
|
||||
attribute :flavor_id
|
||||
|
@ -39,6 +40,7 @@ module Fog
|
|||
# assign these attributes first to prevent race condition with new_record?
|
||||
self.min_count = attributes.delete(:min_count)
|
||||
self.max_count = attributes.delete(:max_count)
|
||||
self.block_device_mapping = attributes.delete(:block_device_mapping)
|
||||
@connection = attributes[:connection]
|
||||
super
|
||||
end
|
||||
|
@ -146,6 +148,10 @@ module Fog
|
|||
@max_count = new_max_count
|
||||
end
|
||||
|
||||
def block_device_mapping=(new_block_device_mapping)
|
||||
@block_device_mapping = new_block_device_mapping
|
||||
end
|
||||
|
||||
def ready?
|
||||
self.state == 'ACTIVE'
|
||||
end
|
||||
|
@ -216,7 +222,9 @@ module Fog
|
|||
'min_count' => @min_count,
|
||||
'max_count' => @max_count,
|
||||
'key_name' => key_name,
|
||||
'security_groups' => security_groups
|
||||
'security_groups' => security_groups,
|
||||
'config_drive' => config_drive,
|
||||
'block_device_mapping' => @block_device_mapping
|
||||
}
|
||||
options = options.reject {|key, value| value.nil?}
|
||||
data = connection.create_server(name, flavor_id, image_id, options)
|
||||
|
|
|
@ -103,6 +103,9 @@ module Fog
|
|||
}
|
||||
end
|
||||
end
|
||||
if options['config_drive']
|
||||
data['server']['config_drive'] = options['config_drive']
|
||||
end
|
||||
if options['block_device_mapping']
|
||||
data['server']['block_device_mapping'] = options['block_device_mapping']
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue