mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Adding network_adapters to VM parser and model as a single IP address doesn't cut when dealing with multiple networks.
This commit is contained in:
parent
deb0e10add
commit
2796973c07
4 changed files with 12 additions and 2 deletions
|
@ -20,6 +20,7 @@ module Fog
|
|||
attribute :cpu, :type => :integer
|
||||
attribute :memory, :type => :integer
|
||||
attribute :hard_disks, :aliases => :disks
|
||||
attribute :network_adapters
|
||||
|
||||
def reload
|
||||
# when collection.vapp is nil, it means it's fatherless,
|
||||
|
|
|
@ -54,9 +54,13 @@ module Fog
|
|||
when 'ElementName'
|
||||
@element_name = value
|
||||
when 'Item'
|
||||
if @resource_type == '17' # disk
|
||||
case @resource_type
|
||||
when '17' # disk
|
||||
@response[:vm][:disks] ||= []
|
||||
@response[:vm][:disks] << { @element_name => @current_host_resource[:capacity].to_i }
|
||||
when '10' # nic
|
||||
@response[:vm][:network_adapters] ||= []
|
||||
@response[:vm][:network_adapters] << { :ip_address => @current_connection[:ipAddress], :primary => (@current_connection[:primaryNetworkConnection] == 'true') }
|
||||
end
|
||||
when 'Link'
|
||||
@response[:vm][:links] = @links
|
||||
|
|
|
@ -64,9 +64,13 @@ module Fog
|
|||
when 'ElementName'
|
||||
@element_name = value
|
||||
when 'Item'
|
||||
if @resource_type == '17' # disk
|
||||
case @resource_type
|
||||
when '17' # disk
|
||||
@vm[:disks] ||= []
|
||||
@vm[:disks] << { @element_name => @current_host_resource[:capacity].to_i }
|
||||
when '10' # nic
|
||||
@vm[:network_adapters] ||= []
|
||||
@vm[:network_adapters] << { :ip_address => @current_connection[:ipAddress], :primary => (@current_connection[:primaryNetworkConnection] == 'true') }
|
||||
end
|
||||
when 'Link'
|
||||
@vm[:links] = @links
|
||||
|
|
|
@ -24,6 +24,7 @@ Shindo.tests("Compute::VcloudDirector | vms", ['vclouddirector', 'all']) do
|
|||
tests("#cpu").returns(Fixnum){ vm.cpu.class }
|
||||
tests("#memory").returns(Fixnum){ vm.memory.class }
|
||||
tests("#hard_disks").returns(Array){ vm.hard_disks.class }
|
||||
tests("#network_adapters").returns(Array){ vm.network_adapters.class }
|
||||
end
|
||||
|
||||
tests("Compute::VcloudDirector | vm", ['get']) do
|
||||
|
|
Loading…
Reference in a new issue