7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/fog/vcloud_director/parsers/compute/vm_parser_helper.rb', line 7
def parse_end_element(name, vm)
case name
when 'IpAddress'
vm[:ip_address] = value
when 'Description'
if @in_operating_system
vm[:operating_system] = value
@in_operating_system = false
end
when 'ResourceType'
@resource_type = value
when 'VirtualQuantity'
case @resource_type
when '3'
vm[:cpu] = value
when '4'
vm[:memory] = value
end
when 'ElementName'
@element_name = value
when 'Item'
if @resource_type == '17' vm[:disks] ||= []
vm[:disks] << { @element_name => @current_host_resource[:capacity].to_i }
end
when 'Connection'
vm[:network_adapters] ||= []
vm[:network_adapters] << {
:ip_address => @current_network_connection[:ipAddress],
:primary => (@current_network_connection[:primaryNetworkConnection] == 'true'),
:ip_allocation_mode => @current_network_connection[:ipAddressingMode],
:network => value
}
when 'Link'
vm[:links] = @links
end
end
|