fog-vcloud-director 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +4 -240
- data/.rubocop_local.yml +1 -0
- data/.travis.yml +5 -10
- data/README.md +3 -0
- data/docs/examples-vm-reconfigure.md +39 -0
- data/docs/vm-to-reconfigure.xml +373 -0
- data/fog-vcloud-director.gemspec +4 -1
- data/lib/fog/vcloud_director.rb +14 -1
- data/lib/fog/vcloud_director/compute.rb +34 -8
- data/lib/fog/vcloud_director/core.rb +0 -3
- data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +1 -1
- data/lib/fog/vcloud_director/generators/compute/reconfigure_vm.rb +110 -0
- data/lib/fog/vcloud_director/generators/compute/vapp.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/catalog.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/catalog_item.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/catalog_items.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/catalogs.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/custom_field.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/disk.rb +1 -2
- data/lib/fog/vcloud_director/models/compute/disks.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/media.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/medias.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/network.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/networks.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/organization.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/organizations.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/tag.rb +1 -2
- data/lib/fog/vcloud_director/models/compute/tags.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/task.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/tasks.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/template_vm.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/template_vms.rb +2 -3
- data/lib/fog/vcloud_director/models/compute/vapp.rb +25 -8
- data/lib/fog/vcloud_director/models/compute/vapp_template.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/vapp_templates.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/vapps.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/vdc.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/vdcs.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/vm.rb +10 -30
- data/lib/fog/vcloud_director/models/compute/vm_customization.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/vm_customizations.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/vm_network.rb +0 -2
- data/lib/fog/vcloud_director/models/compute/vm_networks.rb +0 -1
- data/lib/fog/vcloud_director/models/compute/vms.rb +1 -2
- data/lib/fog/vcloud_director/parsers/compute/vapp.rb +93 -0
- data/lib/fog/vcloud_director/parsers/compute/vm.rb +3 -62
- data/lib/fog/vcloud_director/parsers/compute/vm_parser_helper.rb +47 -0
- data/lib/fog/vcloud_director/parsers/compute/vms.rb +2 -23
- data/lib/fog/vcloud_director/query.rb +0 -1
- data/lib/fog/vcloud_director/requests/compute/delete_vapp.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/get_lease_settings_section_vapp.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/get_template_vm.rb +1 -47
- data/lib/fog/vcloud_director/requests/compute/get_template_vms.rb +0 -13
- data/lib/fog/vcloud_director/requests/compute/get_vapp.rb +4 -3
- data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/get_vapp_owner.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/get_vm.rb +0 -46
- data/lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_power_on_vapp.rb +2 -2
- data/lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb +4 -84
- data/lib/fog/vcloud_director/requests/compute/post_update_vapp_metadata.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_cpu.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_memory.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_metadata_value.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_network_connection_system_section_vapp.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_vm.rb +1 -1
- data/lib/fog/vcloud_director/version.rb +1 -1
- data/spec/common_assertions.rb +42 -0
- data/spec/fixtures/vm.xml +419 -0
- data/spec/secrets.yaml.templ +3 -0
- data/spec/spec_helper.rb +5 -5
- data/spec/vcloud_director/generators/compute/compose_common_spec.rb +1 -6
- data/spec/vcloud_director/generators/compute/compose_vapp_spec.rb +67 -0
- data/spec/vcloud_director/generators/compute/create_snapshot_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/customization_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/disks_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/edge_gateway_service_configuration_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/instantiate_vapp_template_params_spec.rb +1 -4
- data/spec/vcloud_director/generators/compute/metadata_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/org_vdc_network_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/recompose_vapp_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/reconfigure_vm_spec.rb +117 -0
- data/spec/vcloud_director/generators/compute/vapp_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/vm_network_spec.rb +4 -0
- data/spec/vcloud_director/generators/compute/vm_spec.rb +4 -0
- data/spec/vcloud_director/models/compute/basic_spec.rb +44 -0
- data/spec/vcloud_director/models/compute/vapps_spec.rb +104 -0
- data/spec/vcloud_director/models/compute/vms_spec.rb +54 -0
- data/spec/vcloud_director/parsers/compute/disks_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/metadata_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/network_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vm_customization_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vm_network_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vm_parser_helper_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vm_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vms_by_metadata_spec.rb +4 -0
- data/spec/vcloud_director/parsers/compute/vms_spec.rb +4 -0
- data/spec/vcloud_director/requests/compute/basic_spec.rb +212 -0
- data/spec/vcloud_director/requests/compute/get_vapp_spec.rb +11 -0
- data/spec/vcloud_director/requests/compute/get_vdc_spec.rb +10 -0
- data/spec/vcloud_director/requests/compute/instantiate_vapp_template_spec.rb +1 -3
- data/spec/vcloud_director/requests/compute/post_reconfigure_vm_spec.rb +26 -0
- data/spec/vcr_cassettes/authentication.yml +48 -0
- data/spec/vcr_cassettes/get_vapp.yml +937 -0
- data/spec/vcr_cassettes/get_vapps-expired.yml +918 -0
- data/spec/vcr_cassettes/get_vapps-novms.yml +215 -0
- data/spec/vcr_cassettes/get_vapps.yml +118 -0
- data/spec/vcr_cassettes/get_vdc.yml +118 -0
- data/spec/vcr_cassettes/get_vm.yml +398 -0
- data/spec/vcr_cassettes/post_reconfigure_vm-virtual_hardware.yml +445 -0
- data/spec/vcr_spec_helper.rb +34 -0
- data/tasks/test.rake +3 -10
- metadata +129 -5
- data/lib/fog/vcloud_director/requests/compute/get_vms.rb +0 -41
- data/spec/vcloud_director/spec_helper.rb +0 -13
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'fog/core/model'
|
2
1
|
require 'fog/vcloud_director/models/compute/vm_customization'
|
3
2
|
|
4
3
|
module Fog
|
@@ -8,7 +7,6 @@ module Fog
|
|
8
7
|
identity :id
|
9
8
|
|
10
9
|
attribute :vapp_id
|
11
|
-
attribute :vapp_name
|
12
10
|
attribute :name
|
13
11
|
attribute :type
|
14
12
|
attribute :description
|
@@ -18,7 +16,10 @@ module Fog
|
|
18
16
|
attribute :operating_system
|
19
17
|
attribute :ip_address
|
20
18
|
attribute :cpu, :type => :integer
|
19
|
+
attribute :cores_per_socket, :type => :integer
|
20
|
+
attribute :cpu_hot_add, :type => :boolean
|
21
21
|
attribute :memory, :type => :integer
|
22
|
+
attribute :memory_hot_add, :type => :boolean
|
22
23
|
attribute :hard_disks, :aliases => :disks
|
23
24
|
attribute :network_adapters
|
24
25
|
|
@@ -148,38 +149,17 @@ module Fog
|
|
148
149
|
requires :id
|
149
150
|
service.disks(:vm => self)
|
150
151
|
end
|
151
|
-
|
152
|
-
def memory=(new_memory)
|
153
|
-
has_changed = ( memory != new_memory.to_i )
|
154
|
-
not_first_set = !memory.nil?
|
155
|
-
attributes[:memory] = new_memory.to_i
|
156
|
-
if not_first_set && has_changed
|
157
|
-
response = service.put_memory(id, memory)
|
158
|
-
service.process_task(response.body)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
def cpu=(new_cpu)
|
163
|
-
has_changed = ( cpu != new_cpu.to_i )
|
164
|
-
not_first_set = !cpu.nil?
|
165
|
-
attributes[:cpu] = new_cpu.to_i
|
166
|
-
if not_first_set && has_changed
|
167
|
-
response = service.put_cpu(id, cpu)
|
168
|
-
service.process_task(response.body)
|
169
|
-
end
|
170
|
-
end
|
171
152
|
|
172
153
|
# Reconfigure a VM using any of the options documented in
|
173
154
|
# post_reconfigure_vm
|
174
|
-
def reconfigure(options)
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
180
|
-
response = service.post_reconfigure_vm(id, options)
|
155
|
+
def reconfigure(options, current: nil)
|
156
|
+
# Fetch current XML.
|
157
|
+
current ||= service.get_vapp(id, :parser => 'xml').body
|
158
|
+
# Let post_reconfigure_vm apply modifications.
|
159
|
+
response = service.post_reconfigure_vm(id, current, options)
|
181
160
|
service.process_task(response.body)
|
182
|
-
|
161
|
+
|
162
|
+
# TODO: apply modifications on current VM instance.
|
183
163
|
end
|
184
164
|
|
185
165
|
def ready?
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
1
|
require 'fog/vcloud_director/models/compute/vm'
|
3
2
|
|
4
3
|
module Fog
|
@@ -36,7 +35,7 @@ module Fog
|
|
36
35
|
end
|
37
36
|
|
38
37
|
def item_list
|
39
|
-
data = service.
|
38
|
+
data = service.get_vapp(vapp.id).body
|
40
39
|
items = data[:vms]
|
41
40
|
items
|
42
41
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'fog/vcloud_director/parsers/compute/vm_parser_helper'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Parsers
|
5
|
+
module Compute
|
6
|
+
module VcloudDirector
|
7
|
+
class Vapp < VcloudDirectorParser
|
8
|
+
include VmParserHelper
|
9
|
+
|
10
|
+
def reset
|
11
|
+
@response = @vapp = {
|
12
|
+
:lease_settings => 'not-implemented',
|
13
|
+
:network_section => 'not-implemented',
|
14
|
+
:network_config => 'not-implemented'
|
15
|
+
}
|
16
|
+
@in_sections = false
|
17
|
+
@parsing_vm = false
|
18
|
+
end
|
19
|
+
|
20
|
+
def start_element(name, attributes)
|
21
|
+
super
|
22
|
+
return vm_start_element(name, attributes) if @parsing_vm
|
23
|
+
vapp_start_element(name, attributes)
|
24
|
+
end
|
25
|
+
|
26
|
+
def end_element(name)
|
27
|
+
return vm_end_element(name) if @parsing_vm && name != 'Vm'
|
28
|
+
vapp_end_element(name)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def vapp_start_element(name, attributes)
|
34
|
+
case name
|
35
|
+
when 'VApp'
|
36
|
+
vapp_attrs = extract_attributes(attributes)
|
37
|
+
@vapp.merge!(vapp_attrs.reject { |key, _| ![:href, :name, :status, :type, :deployed].include?(key) })
|
38
|
+
@vapp[:id] ||= id_from_url(@vapp[:href], id_prefix: 'vapp-')
|
39
|
+
@vapp[:deployed] = @vapp[:deployed] == 'true'
|
40
|
+
when 'LeaseSettingsSection' # this is the first of the sections
|
41
|
+
@in_sections = true
|
42
|
+
@vapp[:description] ||= '' # if description wasn't parsed by now, then vApp has empty description
|
43
|
+
when 'User'
|
44
|
+
@vapp[:owner] = attr_value('href', attributes).to_s.split('/').last
|
45
|
+
when 'Vm'
|
46
|
+
@parsing_vm = true
|
47
|
+
vm_reset(@vapp[:id])
|
48
|
+
vm_start_element(name, attributes)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def vapp_end_element(name)
|
53
|
+
case name
|
54
|
+
when 'Description'
|
55
|
+
@vapp[:description] = value unless @in_sections
|
56
|
+
when 'InMaintenanceMode'
|
57
|
+
@vapp[:maintenance] = value == 'true'
|
58
|
+
when 'Vm'
|
59
|
+
@parsing_vm = false
|
60
|
+
@vapp[:vms] ||= []
|
61
|
+
@vapp[:vms] << @curr_vm
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Nested VMs
|
67
|
+
#
|
68
|
+
|
69
|
+
def vm_start_element(name, attributes)
|
70
|
+
return parse_vm_attributes(attributes, @curr_vm) if name == 'Vm'
|
71
|
+
parse_start_element(name, attributes, @curr_vm)
|
72
|
+
end
|
73
|
+
|
74
|
+
def vm_end_element(name)
|
75
|
+
parse_end_element(name, @curr_vm)
|
76
|
+
end
|
77
|
+
|
78
|
+
def vm_reset(vapp_id)
|
79
|
+
@curr_vm = initialize_vm
|
80
|
+
@curr_vm[:vapp_id] = vapp_id
|
81
|
+
@in_operating_system = false
|
82
|
+
@in_children = false
|
83
|
+
@resource_type = nil
|
84
|
+
@links = []
|
85
|
+
@element_name = nil
|
86
|
+
@current_network_connection = nil
|
87
|
+
@current_host_resource = nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -11,77 +11,18 @@ module Fog
|
|
11
11
|
@in_operating_system = false
|
12
12
|
@in_children = false
|
13
13
|
@resource_type = nil
|
14
|
-
@response = { :vm =>
|
14
|
+
@response = { :vm => initialize_vm }
|
15
15
|
@links = []
|
16
16
|
end
|
17
17
|
|
18
18
|
def start_element(name, attributes)
|
19
19
|
super
|
20
|
-
if name == 'Vm'
|
21
|
-
|
22
|
-
@response[:vm].merge!(vm_attrs.reject {|key,value| ![:href, :name, :status, :type, :deployed].include?(key)})
|
23
|
-
@response[:vm][:id] = @response[:vm][:href].split('/').last
|
24
|
-
@response[:vm][:status] = human_status(@response[:vm][:status])
|
25
|
-
@response[:vm][:deployed] = @response[:vm][:deployed] == 'true'
|
26
|
-
else
|
27
|
-
parse_start_element name, attributes, @response[:vm]
|
28
|
-
end
|
20
|
+
return parse_vm_attributes(attributes, @response[:vm]) if name == 'Vm'
|
21
|
+
parse_start_element name, attributes, @response[:vm]
|
29
22
|
end
|
30
23
|
|
31
24
|
def end_element(name)
|
32
25
|
parse_end_element name, @response[:vm]
|
33
|
-
case name
|
34
|
-
when 'IpAddress'
|
35
|
-
@response[:vm][:ip_address] = value
|
36
|
-
when 'Description'
|
37
|
-
if @in_operating_system
|
38
|
-
@response[:vm][:operating_system] = value
|
39
|
-
@in_operating_system = false
|
40
|
-
end
|
41
|
-
when 'ResourceType'
|
42
|
-
@resource_type = value
|
43
|
-
when 'VirtualQuantity'
|
44
|
-
case @resource_type
|
45
|
-
when '3'
|
46
|
-
@response[:vm][:cpu] = value
|
47
|
-
when '4'
|
48
|
-
@response[:vm][:memory] = value
|
49
|
-
end
|
50
|
-
when 'ElementName'
|
51
|
-
@element_name = value
|
52
|
-
when 'Item'
|
53
|
-
case @resource_type
|
54
|
-
when '17' # disk
|
55
|
-
@response[:vm][:disks] ||= []
|
56
|
-
@response[:vm][:disks] << { @element_name => @current_host_resource[:capacity].to_i }
|
57
|
-
when '10' # nic
|
58
|
-
@response[:vm][:network_adapters] ||= []
|
59
|
-
@response[:vm][:network_adapters] << {
|
60
|
-
:ip_address => @current_network_connection[:ipAddress],
|
61
|
-
:primary => (@current_network_connection[:primaryNetworkConnection] == 'true'),
|
62
|
-
:ip_allocation_mode => @current_network_connection[:ipAddressingMode]
|
63
|
-
}
|
64
|
-
end
|
65
|
-
when 'Link'
|
66
|
-
@response[:vm][:links] = @links
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def human_status(status)
|
71
|
-
case status
|
72
|
-
when '-1', -1
|
73
|
-
'failed_creation'
|
74
|
-
when '0', 0
|
75
|
-
'creating'
|
76
|
-
when '8', 8
|
77
|
-
'off'
|
78
|
-
when '4', 4
|
79
|
-
'on'
|
80
|
-
when '3', 3
|
81
|
-
'suspended'
|
82
|
-
else
|
83
|
-
'unknown'
|
84
|
-
end
|
85
26
|
end
|
86
27
|
end
|
87
28
|
end
|
@@ -3,6 +3,15 @@ module Fog
|
|
3
3
|
module Compute
|
4
4
|
module VcloudDirector
|
5
5
|
module VmParserHelper
|
6
|
+
def initialize_vm
|
7
|
+
{
|
8
|
+
:vapp_id => nil,
|
9
|
+
:ip_address => '',
|
10
|
+
:description => '',
|
11
|
+
:cpu_hot_add => nil,
|
12
|
+
:memory_hot_add => nil
|
13
|
+
}
|
14
|
+
end
|
6
15
|
|
7
16
|
def parse_end_element(name, vm)
|
8
17
|
case name
|
@@ -39,6 +48,12 @@ module Fog
|
|
39
48
|
}
|
40
49
|
when 'Link'
|
41
50
|
vm[:links] = @links
|
51
|
+
when 'CoresPerSocket'
|
52
|
+
vm[:cores_per_socket] = value
|
53
|
+
when 'CpuHotAddEnabled'
|
54
|
+
vm[:cpu_hot_add] = value == 'true'
|
55
|
+
when 'MemoryHotAddEnabled'
|
56
|
+
vm[:memory_hot_add] = value == 'true'
|
42
57
|
end
|
43
58
|
end
|
44
59
|
|
@@ -46,15 +61,47 @@ module Fog
|
|
46
61
|
case name
|
47
62
|
when 'OperatingSystemSection'
|
48
63
|
@in_operating_system = true
|
64
|
+
vm[:cores_per_socket] ||= 1 # VirtualHardwareSection was parsed if we're here and if no value was specified, we default to 1
|
49
65
|
when 'HostResource'
|
50
66
|
@current_host_resource = extract_attributes(attributes)
|
51
67
|
when 'Connection'
|
52
68
|
@current_network_connection = extract_attributes(attributes)
|
53
69
|
when 'Link'
|
70
|
+
# Parse vapp id from any link if not found elsewhere.
|
71
|
+
vm[:vapp_id] ||= id_from_url(attr_value('href', attributes), :id_prefix => 'vapp-')
|
72
|
+
|
54
73
|
@links << extract_attributes(attributes)
|
55
74
|
end
|
56
75
|
end
|
57
76
|
|
77
|
+
def parse_vm_attributes(attributes, vm)
|
78
|
+
vm_attrs = extract_attributes(attributes)
|
79
|
+
vm.merge!(vm_attrs.select { |key, _| %i(href name status type deployed).include?(key) })
|
80
|
+
vm[:id] = vm[:href].split('/').last
|
81
|
+
vm[:status] = human_status(vm[:status])
|
82
|
+
vm[:deployed] = vm[:deployed] == 'true'
|
83
|
+
end
|
84
|
+
|
85
|
+
def human_status(status)
|
86
|
+
case status
|
87
|
+
when '-1', -1
|
88
|
+
'failed_creation'
|
89
|
+
when '0', 0
|
90
|
+
'creating'
|
91
|
+
when '8', 8
|
92
|
+
'off'
|
93
|
+
when '4', 4
|
94
|
+
'on'
|
95
|
+
when '3', 3
|
96
|
+
'suspended'
|
97
|
+
else
|
98
|
+
'unknown'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def id_from_url(url, id_prefix: 'vapp-')
|
103
|
+
url.split('/').detect { |part| part.start_with?(id_prefix) }
|
104
|
+
end
|
58
105
|
end
|
59
106
|
end
|
60
107
|
end
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
include VmParserHelper
|
9
9
|
|
10
10
|
def reset
|
11
|
-
@vm =
|
11
|
+
@vm = initialize_vm
|
12
12
|
@in_operating_system = false
|
13
13
|
@in_children = false
|
14
14
|
@resource_type = nil
|
@@ -20,13 +20,7 @@ module Fog
|
|
20
20
|
super
|
21
21
|
case name
|
22
22
|
when 'Vm'
|
23
|
-
|
24
|
-
@vm.merge!(vapp.reject {|key,value| ![:href, :name, :status, :type, :deployed].include?(key)})
|
25
|
-
@vm[:deployed] = response[:deployed] == 'true'
|
26
|
-
@vm[:id] = @vm[:href].split('/').last
|
27
|
-
@vm[:vapp_id] = @response[:id]
|
28
|
-
@vm[:vapp_name] = @response[:name]
|
29
|
-
@vm[:status] = human_status(@vm[:status])
|
23
|
+
parse_vm_attributes(attributes, @vm)
|
30
24
|
when 'VApp'
|
31
25
|
vapp = extract_attributes(attributes)
|
32
26
|
@response.merge!(vapp.reject {|key,value| ![:href, :name, :size, :status, :type].include?(key)})
|
@@ -48,21 +42,6 @@ module Fog
|
|
48
42
|
end
|
49
43
|
end
|
50
44
|
end
|
51
|
-
|
52
|
-
def human_status(status)
|
53
|
-
case status
|
54
|
-
when '0', 0
|
55
|
-
'creating'
|
56
|
-
when '8', 8
|
57
|
-
'off'
|
58
|
-
when '4', 4
|
59
|
-
'on'
|
60
|
-
when '3', 3
|
61
|
-
'suspended'
|
62
|
-
else
|
63
|
-
'unknown'
|
64
|
-
end
|
65
|
-
end
|
66
45
|
end
|
67
46
|
end
|
68
47
|
end
|