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 1e0318729f
commit 5f5b1d6e15

View file

@ -30,6 +30,41 @@ module Fog
def end_element(name)
parse_end_element name, @response[:vm]
case name
when 'IpAddress'
@response[:vm][:ip_address] = value
when 'Description'
if @in_operating_system
@response[:vm][:operating_system] = value
@in_operating_system = false
end
when 'ResourceType'
@resource_type = value
when 'VirtualQuantity'
case @resource_type
when '3'
@response[:vm][:cpu] = value
when '4'
@response[:vm][:memory] = value
end
when 'ElementName'
@element_name = value
when 'Item'
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_network_connection[:ipAddress],
:primary => (@current_network_connection[:primaryNetworkConnection] == 'true'),
:ip_allocation_mode => @current_network_connection[:ipAddressingMode]
}
end
when 'Link'
@response[:vm][:links] = @links
end
end
def human_status(status)