mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #1669 from frodenas/boot_with_nics
[openstack|compute] Allow booting a VM with NICs (net_id, port_id, fixed_ip)
This commit is contained in:
commit
ee071fada7
2 changed files with 15 additions and 2 deletions
|
@ -40,7 +40,7 @@ module Fog
|
||||||
attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state'
|
attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state'
|
||||||
|
|
||||||
attr_reader :password
|
attr_reader :password
|
||||||
attr_writer :image_ref, :flavor_ref, :os_scheduler_hints
|
attr_writer :image_ref, :flavor_ref, :nics, :os_scheduler_hints
|
||||||
|
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
|
@ -50,6 +50,7 @@ module Fog
|
||||||
self.security_groups = attributes.delete(:security_groups)
|
self.security_groups = attributes.delete(:security_groups)
|
||||||
self.min_count = attributes.delete(:min_count)
|
self.min_count = attributes.delete(:min_count)
|
||||||
self.max_count = attributes.delete(:max_count)
|
self.max_count = attributes.delete(:max_count)
|
||||||
|
self.nics = attributes.delete(:nics)
|
||||||
self.os_scheduler_hints = attributes.delete(:os_scheduler_hints)
|
self.os_scheduler_hints = attributes.delete(:os_scheduler_hints)
|
||||||
|
|
||||||
super
|
super
|
||||||
|
@ -256,7 +257,8 @@ module Fog
|
||||||
'security_groups' => @security_groups,
|
'security_groups' => @security_groups,
|
||||||
'min_count' => @min_count,
|
'min_count' => @min_count,
|
||||||
'max_count' => @max_count,
|
'max_count' => @max_count,
|
||||||
'os:scheduler_hints' => @os_scheduler_hints
|
'nics' => @nics,
|
||||||
|
'os:scheduler_hints' => @os_scheduler_hints,
|
||||||
}
|
}
|
||||||
options['metadata'] = metadata.to_hash unless @metadata.nil?
|
options['metadata'] = metadata.to_hash unless @metadata.nil?
|
||||||
options = options.reject {|key, value| value.nil?}
|
options = options.reject {|key, value| value.nil?}
|
||||||
|
|
|
@ -41,6 +41,17 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options['nics']
|
||||||
|
data['server']['networks'] =
|
||||||
|
Array(options['nics']).map do |nic|
|
||||||
|
{
|
||||||
|
'uuid' => nic['net_id'],
|
||||||
|
'fixed_ip' => nic['v4_fixed_ip'],
|
||||||
|
'port' => nic['port_id']
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if options['os:scheduler_hints']
|
if options['os:scheduler_hints']
|
||||||
data['os:scheduler_hints'] = options['os:scheduler_hints']
|
data['os:scheduler_hints'] = options['os:scheduler_hints']
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue