opennebula 5.12.13 → 5.13.80.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +1 -1
  4. data/lib/DriverExecHelper.rb +44 -28
  5. data/lib/OpenNebulaDriver.rb +8 -4
  6. data/lib/VirtualMachineDriver.rb +9 -2
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/datacenter.rb +1258 -0
  9. data/lib/datastore.rb +1025 -0
  10. data/lib/distributed_firewall.rb +280 -0
  11. data/lib/file_helper.rb +370 -0
  12. data/lib/host.rb +1517 -0
  13. data/lib/logical_port.rb +50 -0
  14. data/lib/logical_switch.rb +77 -0
  15. data/lib/memoize.rb +74 -0
  16. data/lib/models/role.rb +39 -8
  17. data/lib/models/service.rb +92 -31
  18. data/lib/models.rb +5 -5
  19. data/lib/network.rb +635 -0
  20. data/lib/nsx_client.rb +144 -0
  21. data/lib/nsx_component.rb +28 -0
  22. data/lib/nsx_constants.rb +149 -0
  23. data/lib/nsx_driver.rb +78 -0
  24. data/lib/nsx_error.rb +77 -0
  25. data/lib/nsx_rule.rb +193 -0
  26. data/lib/nsxt_client.rb +176 -0
  27. data/lib/nsxt_dfw.rb +196 -0
  28. data/lib/nsxt_logical_port.rb +94 -0
  29. data/lib/nsxt_rule.rb +188 -0
  30. data/lib/nsxt_tz.rb +38 -0
  31. data/lib/nsxv_client.rb +176 -0
  32. data/lib/nsxv_dfw.rb +202 -0
  33. data/lib/nsxv_logical_port.rb +107 -0
  34. data/lib/nsxv_rule.rb +172 -0
  35. data/lib/nsxv_tz.rb +41 -0
  36. data/lib/opaque_network.rb +134 -0
  37. data/lib/opennebula/acl.rb +1 -1
  38. data/lib/opennebula/acl_pool.rb +1 -1
  39. data/lib/opennebula/client.rb +1 -1
  40. data/lib/opennebula/cluster.rb +1 -1
  41. data/lib/opennebula/cluster_pool.rb +1 -1
  42. data/lib/opennebula/datastore.rb +1 -1
  43. data/lib/opennebula/datastore_pool.rb +1 -1
  44. data/lib/opennebula/document.rb +8 -29
  45. data/lib/opennebula/document_json.rb +42 -12
  46. data/lib/opennebula/document_pool.rb +1 -1
  47. data/lib/opennebula/document_pool_json.rb +1 -1
  48. data/lib/opennebula/error.rb +4 -1
  49. data/lib/opennebula/flow/grammar.rb +1195 -0
  50. data/lib/{models → opennebula/flow}/service_pool.rb +26 -2
  51. data/lib/{models → opennebula/flow}/service_template.rb +86 -17
  52. data/lib/opennebula/flow/service_template_ext.rb +84 -0
  53. data/lib/{models → opennebula/flow}/service_template_pool.rb +1 -1
  54. data/lib/opennebula/flow/validator.rb +499 -0
  55. data/lib/opennebula/flow.rb +23 -0
  56. data/lib/opennebula/group.rb +1 -1
  57. data/lib/opennebula/group_pool.rb +1 -1
  58. data/lib/opennebula/hook.rb +5 -12
  59. data/lib/opennebula/hook_log.rb +1 -1
  60. data/lib/opennebula/hook_pool.rb +1 -1
  61. data/lib/opennebula/host.rb +1 -1
  62. data/lib/opennebula/host_pool.rb +1 -1
  63. data/lib/opennebula/image.rb +17 -14
  64. data/lib/opennebula/image_pool.rb +1 -1
  65. data/lib/opennebula/ldap_auth.rb +1 -1
  66. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  67. data/lib/opennebula/lockable_ext.rb +163 -0
  68. data/lib/opennebula/marketplace.rb +1 -1
  69. data/lib/opennebula/marketplace_pool.rb +1 -1
  70. data/lib/opennebula/marketplaceapp.rb +9 -119
  71. data/lib/opennebula/marketplaceapp_ext.rb +522 -0
  72. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  73. data/lib/opennebula/oneflow_client.rb +4 -3
  74. data/lib/opennebula/pool.rb +4 -3
  75. data/lib/opennebula/pool_element.rb +1 -1
  76. data/lib/opennebula/security_group.rb +1 -1
  77. data/lib/opennebula/security_group_pool.rb +1 -1
  78. data/lib/opennebula/server_cipher_auth.rb +1 -1
  79. data/lib/opennebula/server_x509_auth.rb +1 -1
  80. data/lib/opennebula/ssh_auth.rb +1 -1
  81. data/lib/opennebula/system.rb +1 -1
  82. data/lib/opennebula/template.rb +4 -13
  83. data/lib/opennebula/template_ext.rb +325 -0
  84. data/lib/opennebula/template_pool.rb +1 -1
  85. data/lib/opennebula/user.rb +26 -2
  86. data/lib/opennebula/user_pool.rb +1 -1
  87. data/lib/opennebula/utils.rb +1 -1
  88. data/lib/opennebula/vdc.rb +1 -1
  89. data/lib/opennebula/vdc_pool.rb +1 -1
  90. data/lib/opennebula/virtual_machine.rb +25 -207
  91. data/lib/opennebula/virtual_machine_ext.rb +469 -0
  92. data/lib/opennebula/virtual_machine_pool.rb +1 -5
  93. data/lib/opennebula/virtual_network.rb +4 -10
  94. data/lib/opennebula/virtual_network_pool.rb +1 -1
  95. data/lib/opennebula/virtual_router.rb +4 -12
  96. data/lib/opennebula/virtual_router_pool.rb +1 -1
  97. data/lib/opennebula/vm_group.rb +4 -11
  98. data/lib/opennebula/vm_group_pool.rb +1 -1
  99. data/lib/opennebula/vntemplate.rb +4 -13
  100. data/lib/opennebula/vntemplate_pool.rb +1 -1
  101. data/lib/opennebula/wait_ext.rb +222 -0
  102. data/lib/opennebula/x509_auth.rb +1 -1
  103. data/lib/opennebula/xml_element.rb +1 -1
  104. data/lib/opennebula/xml_pool.rb +1 -1
  105. data/lib/opennebula/xml_utils.rb +1 -1
  106. data/lib/opennebula/zone.rb +1 -1
  107. data/lib/opennebula/zone_pool.rb +1 -1
  108. data/lib/opennebula.rb +5 -2
  109. data/lib/rest_client.rb +201 -0
  110. data/lib/scripts_common.rb +180 -0
  111. data/lib/transport_zone.rb +43 -0
  112. data/lib/vcenter_driver.rb +9 -22
  113. data/lib/vcenter_importer.rb +616 -0
  114. data/lib/vi_client.rb +281 -0
  115. data/lib/vi_helper.rb +312 -0
  116. data/lib/virtual_machine.rb +3477 -0
  117. data/lib/virtual_wire.rb +158 -0
  118. data/lib/vm_device.rb +80 -0
  119. data/lib/vm_disk.rb +202 -0
  120. data/lib/vm_folder.rb +69 -0
  121. data/lib/vm_helper.rb +30 -0
  122. data/lib/vm_monitor.rb +303 -0
  123. data/lib/vm_nic.rb +70 -0
  124. data/lib/vm_template.rb +1961 -0
  125. data/lib/vmm_importer.rb +121 -0
  126. metadata +101 -35
@@ -0,0 +1,121 @@
1
+ module VCenterDriver
2
+
3
+ # Functionality to import vCenter VMs into OpenNebula
4
+ class VmmImporter < VCenterDriver::VcImporter
5
+
6
+ def initialize(one_client, vi_client)
7
+ super(one_client, vi_client)
8
+ @one_class = OpenNebula::VirtualMachine
9
+ @defaults = {}
10
+ end
11
+
12
+ def list(key, list)
13
+ @list = { key => list }
14
+ end
15
+
16
+ def request_vnc(vc_vm)
17
+ one_vm = vc_vm.one_item
18
+ vnc_port = one_vm['TEMPLATE/GRAPHICS/PORT']
19
+ elapsed_seconds = 0
20
+
21
+ # Let's update the info to gather VNC port
22
+ until vnc_port || elapsed_seconds > 30
23
+ sleep(1)
24
+ one_vm.info
25
+ vnc_port = one_vm['TEMPLATE/GRAPHICS/PORT']
26
+ elapsed_seconds += 1
27
+ end
28
+
29
+ return unless vnc_port
30
+
31
+ extraconfig = []
32
+ extraconfig += vc_vm.extraconfig_vnc
33
+ spec_hash = { :extraConfig => extraconfig }
34
+ spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
35
+ vc_vm.item.ReconfigVM_Task(:spec => spec).wait_for_completion
36
+ end
37
+
38
+ def build
39
+ xml = OpenNebula::VirtualMachine.build_xml
40
+ OpenNebula::VirtualMachine.new(xml, @one_client)
41
+ end
42
+
43
+ def import(selected)
44
+ import_tmplt = selected['IMPORT_TEMPLATE']
45
+ import_tmplt = Base64.decode64(import_tmplt) if import_tmplt
46
+ vm_ref = selected['DEPLOY_ID'] || selected[:wild]['DEPLOY_ID']
47
+ vm = selected[:one_item] || build
48
+ template = selected[:template] || import_tmplt
49
+ host_id = selected[:host] || @list.keys[0]
50
+
51
+ vc_uuid = @vi_client.vim.serviceContent.about.instanceUuid
52
+ vc_name = @vi_client.vim.host
53
+ dpool, ipool, npool, hpool = create_pools
54
+
55
+ vc_vm = VCenterDriver::VirtualMachine.new_without_id(@vi_client,
56
+ vm_ref)
57
+ vname = vc_vm['name']
58
+
59
+ type = { :object => 'VM', :id => vname }
60
+ error, template_disks = vc_vm.import_vcenter_disks(vc_uuid, dpool,
61
+ ipool, type)
62
+ raise error unless error.empty?
63
+
64
+ template << template_disks
65
+
66
+ opts = {
67
+ :vi_client => @vi_client,
68
+ :vc_uuid => vc_uuid,
69
+ :npool => npool,
70
+ :hpool => hpool,
71
+ :vcenter => vc_name,
72
+ :template_moref => vm_ref,
73
+ :vm_object => vc_vm
74
+ }
75
+
76
+ # Create images or get nics information for template
77
+ error, template_nics, ar_ids =
78
+ vc_vm.import_vcenter_nics(opts)
79
+ opts = { :uuid => vc_uuid, :npool => npool, :error => error }
80
+ Raction.delete_ars(ar_ids, opts) unless error.empty?
81
+
82
+ template << template_nics
83
+ template << "VCENTER_ESX_HOST = #{vc_vm['runtime.host.name']}\n"
84
+
85
+ # Get DS_ID for the deployment, the wild VM needs a System DS
86
+ dc_ref = vc_vm.datacenter.item._ref
87
+ ds_ref = template.match(/^VCENTER_DS_REF *= *"(.*)" *$/)[1]
88
+
89
+ ds_one = dpool.select do |e|
90
+ e['TEMPLATE/TYPE'] == 'SYSTEM_DS' &&
91
+ e['TEMPLATE/VCENTER_DS_REF'] == ds_ref &&
92
+ e['TEMPLATE/VCENTER_DC_REF'] == dc_ref &&
93
+ e['TEMPLATE/VCENTER_INSTANCE_ID'] == vc_uuid
94
+ end.first
95
+ opts[:error] = "ds with ref #{ds_ref} is not imported, aborting"
96
+ Raction.delete_ars(ar_ids, opts) unless ds_one
97
+
98
+ rc = vm.allocate(template)
99
+ if OpenNebula.is_error?(rc)
100
+ Raction.delete_ars(ar_ids, opts.merge(:error => rc.message))
101
+ end
102
+
103
+ rc = vm.deploy(host_id, false, ds_one.id)
104
+ if OpenNebula.is_error?(rc)
105
+ Raction.delete_ars(ar_ids, opts.merge(:error => rc.message))
106
+ end
107
+
108
+ # Set reference to template disks and nics in VM template
109
+ vc_vm.one_item = vm
110
+
111
+ request_vnc(vc_vm)
112
+
113
+ # Sync disks with extraConfig
114
+ vc_vm.reference_all_disks
115
+
116
+ vm.id
117
+ end
118
+
119
+ end
120
+
121
+ end
metadata CHANGED
@@ -1,97 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.12.13
4
+ version: 5.13.80.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2021-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rbvmomi
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: xmlrpc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: treetop
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - '>='
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - '>='
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: ipaddress
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - '>='
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - '>='
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: parse-cron
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
101
+ - - '>='
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - '>='
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  description: Libraries needed to talk to OpenNebula
@@ -100,21 +114,58 @@ executables: []
100
114
  extensions: []
101
115
  extra_rdoc_files: []
102
116
  files:
103
- - LICENSE
104
- - NOTICE
105
- - lib/ActionManager.rb
117
+ - lib/opennebula.rb
118
+ - lib/vcenter_driver.rb
119
+ - lib/datacenter.rb
120
+ - lib/datastore.rb
121
+ - lib/file_helper.rb
122
+ - lib/host.rb
123
+ - lib/memoize.rb
124
+ - lib/network.rb
125
+ - lib/rest_client.rb
126
+ - lib/vcenter_importer.rb
127
+ - lib/vi_client.rb
128
+ - lib/vi_helper.rb
129
+ - lib/virtual_machine.rb
130
+ - lib/vm_device.rb
131
+ - lib/vm_disk.rb
132
+ - lib/vm_nic.rb
133
+ - lib/vm_helper.rb
134
+ - lib/vm_monitor.rb
135
+ - lib/vm_folder.rb
136
+ - lib/vm_template.rb
137
+ - lib/vmm_importer.rb
138
+ - lib/nsx_driver.rb
139
+ - lib/distributed_firewall.rb
140
+ - lib/logical_port.rb
141
+ - lib/logical_switch.rb
142
+ - lib/nsx_client.rb
143
+ - lib/nsx_component.rb
144
+ - lib/nsx_constants.rb
145
+ - lib/nsx_error.rb
146
+ - lib/nsx_rule.rb
147
+ - lib/nsxt_client.rb
148
+ - lib/nsxt_dfw.rb
149
+ - lib/nsxt_logical_port.rb
150
+ - lib/nsxt_rule.rb
151
+ - lib/nsxt_tz.rb
152
+ - lib/nsxv_client.rb
153
+ - lib/nsxv_dfw.rb
154
+ - lib/nsxv_logical_port.rb
155
+ - lib/nsxv_rule.rb
156
+ - lib/nsxv_tz.rb
157
+ - lib/opaque_network.rb
158
+ - lib/transport_zone.rb
159
+ - lib/virtual_wire.rb
160
+ - lib/VirtualMachineDriver.rb
161
+ - lib/OpenNebulaDriver.rb
106
162
  - lib/CommandManager.rb
163
+ - lib/ActionManager.rb
107
164
  - lib/DriverExecHelper.rb
108
- - lib/OpenNebulaDriver.rb
109
- - lib/VirtualMachineDriver.rb
110
- - lib/cloud/CloudClient.rb
165
+ - lib/scripts_common.rb
111
166
  - lib/models.rb
112
167
  - lib/models/role.rb
113
168
  - lib/models/service.rb
114
- - lib/models/service_pool.rb
115
- - lib/models/service_template.rb
116
- - lib/models/service_template_pool.rb
117
- - lib/opennebula.rb
118
169
  - lib/opennebula/acl.rb
119
170
  - lib/opennebula/acl_pool.rb
120
171
  - lib/opennebula/client.rb
@@ -127,6 +178,7 @@ files:
127
178
  - lib/opennebula/document_pool.rb
128
179
  - lib/opennebula/document_pool_json.rb
129
180
  - lib/opennebula/error.rb
181
+ - lib/opennebula/flow.rb
130
182
  - lib/opennebula/group.rb
131
183
  - lib/opennebula/group_pool.rb
132
184
  - lib/opennebula/hook.rb
@@ -136,22 +188,20 @@ files:
136
188
  - lib/opennebula/host_pool.rb
137
189
  - lib/opennebula/image.rb
138
190
  - lib/opennebula/image_pool.rb
139
- - lib/opennebula/ldap_auth.rb
140
- - lib/opennebula/ldap_auth_spec.rb
191
+ - lib/opennebula/lockable_ext.rb
141
192
  - lib/opennebula/marketplace.rb
142
193
  - lib/opennebula/marketplace_pool.rb
143
194
  - lib/opennebula/marketplaceapp.rb
195
+ - lib/opennebula/marketplaceapp_ext.rb
144
196
  - lib/opennebula/marketplaceapp_pool.rb
145
197
  - lib/opennebula/oneflow_client.rb
146
198
  - lib/opennebula/pool.rb
147
199
  - lib/opennebula/pool_element.rb
148
200
  - lib/opennebula/security_group.rb
149
201
  - lib/opennebula/security_group_pool.rb
150
- - lib/opennebula/server_cipher_auth.rb
151
- - lib/opennebula/server_x509_auth.rb
152
- - lib/opennebula/ssh_auth.rb
153
202
  - lib/opennebula/system.rb
154
203
  - lib/opennebula/template.rb
204
+ - lib/opennebula/template_ext.rb
155
205
  - lib/opennebula/template_pool.rb
156
206
  - lib/opennebula/user.rb
157
207
  - lib/opennebula/user_pool.rb
@@ -159,6 +209,7 @@ files:
159
209
  - lib/opennebula/vdc.rb
160
210
  - lib/opennebula/vdc_pool.rb
161
211
  - lib/opennebula/virtual_machine.rb
212
+ - lib/opennebula/virtual_machine_ext.rb
162
213
  - lib/opennebula/virtual_machine_pool.rb
163
214
  - lib/opennebula/virtual_network.rb
164
215
  - lib/opennebula/virtual_network_pool.rb
@@ -168,13 +219,27 @@ files:
168
219
  - lib/opennebula/vm_group_pool.rb
169
220
  - lib/opennebula/vntemplate.rb
170
221
  - lib/opennebula/vntemplate_pool.rb
171
- - lib/opennebula/x509_auth.rb
222
+ - lib/opennebula/wait_ext.rb
172
223
  - lib/opennebula/xml_element.rb
173
224
  - lib/opennebula/xml_pool.rb
174
225
  - lib/opennebula/xml_utils.rb
175
226
  - lib/opennebula/zone.rb
176
227
  - lib/opennebula/zone_pool.rb
177
- - lib/vcenter_driver.rb
228
+ - lib/opennebula/flow/grammar.rb
229
+ - lib/opennebula/flow/service_pool.rb
230
+ - lib/opennebula/flow/service_template.rb
231
+ - lib/opennebula/flow/service_template_ext.rb
232
+ - lib/opennebula/flow/service_template_pool.rb
233
+ - lib/opennebula/flow/validator.rb
234
+ - lib/opennebula/ldap_auth.rb
235
+ - lib/opennebula/ldap_auth_spec.rb
236
+ - lib/opennebula/server_cipher_auth.rb
237
+ - lib/opennebula/server_x509_auth.rb
238
+ - lib/opennebula/ssh_auth.rb
239
+ - lib/opennebula/x509_auth.rb
240
+ - lib/cloud/CloudClient.rb
241
+ - NOTICE
242
+ - LICENSE
178
243
  homepage: http://opennebula.io
179
244
  licenses:
180
245
  - Apache-2.0
@@ -185,16 +250,17 @@ require_paths:
185
250
  - lib
186
251
  required_ruby_version: !ruby/object:Gem::Requirement
187
252
  requirements:
188
- - - ">="
253
+ - - '>='
189
254
  - !ruby/object:Gem::Version
190
255
  version: '0'
191
256
  required_rubygems_version: !ruby/object:Gem::Requirement
192
257
  requirements:
193
- - - ">="
258
+ - - '>'
194
259
  - !ruby/object:Gem::Version
195
- version: '0'
260
+ version: 1.3.1
196
261
  requirements: []
197
- rubygems_version: 3.1.2
262
+ rubyforge_project:
263
+ rubygems_version: 2.0.14.1
198
264
  signing_key:
199
265
  specification_version: 4
200
266
  summary: OpenNebula Client API