1
0
Fork 0
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:
Daniel Aragao 2014-06-11 13:04:43 +10:00 committed by Dan Aragao
parent deb0e10add
commit 2796973c07
4 changed files with 12 additions and 2 deletions

View file

@ -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,

View file

@ -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

View file

@ -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

View file

@ -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