opennebula 6.10.3 → 6.99.85.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cloud/CloudClient.rb +3 -3
  3. data/lib/models/role.rb +349 -823
  4. data/lib/models/service.rb +156 -80
  5. data/lib/models/vmrole.rb +703 -0
  6. data/lib/models/vrrole.rb +284 -0
  7. data/lib/models.rb +3 -1
  8. data/lib/opennebula/acl.rb +1 -1
  9. data/lib/opennebula/acl_pool.rb +1 -1
  10. data/lib/opennebula/backupjob.rb +1 -1
  11. data/lib/opennebula/backupjob_pool.rb +1 -1
  12. data/lib/opennebula/client.rb +1 -1
  13. data/lib/opennebula/cluster.rb +45 -2
  14. data/lib/opennebula/cluster_pool.rb +1 -1
  15. data/lib/opennebula/datastore.rb +1 -1
  16. data/lib/opennebula/datastore_pool.rb +1 -1
  17. data/lib/opennebula/document.rb +1 -1
  18. data/lib/opennebula/document_json.rb +1 -1
  19. data/lib/opennebula/document_pool.rb +1 -1
  20. data/lib/opennebula/document_pool_json.rb +1 -1
  21. data/lib/opennebula/error.rb +1 -1
  22. data/lib/opennebula/flow/grammar.rb +1 -1
  23. data/lib/opennebula/flow/service_pool.rb +1 -1
  24. data/lib/opennebula/flow/service_template.rb +353 -97
  25. data/lib/opennebula/flow/service_template_ext.rb +3 -3
  26. data/lib/opennebula/flow/service_template_pool.rb +1 -1
  27. data/lib/opennebula/flow/validator.rb +458 -410
  28. data/lib/opennebula/flow.rb +1 -1
  29. data/lib/opennebula/group.rb +1 -1
  30. data/lib/opennebula/group_pool.rb +1 -1
  31. data/lib/opennebula/hook.rb +1 -1
  32. data/lib/opennebula/hook_log.rb +1 -1
  33. data/lib/opennebula/hook_pool.rb +1 -1
  34. data/lib/opennebula/host.rb +1 -60
  35. data/lib/opennebula/host_pool.rb +1 -1
  36. data/lib/opennebula/image.rb +1 -1
  37. data/lib/opennebula/image_pool.rb +1 -1
  38. data/lib/opennebula/ldap_auth.rb +1 -1
  39. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  40. data/lib/opennebula/lockable_ext.rb +1 -1
  41. data/lib/opennebula/marketplace.rb +1 -1
  42. data/lib/opennebula/marketplace_pool.rb +1 -1
  43. data/lib/opennebula/marketplaceapp.rb +1 -1
  44. data/lib/opennebula/marketplaceapp_ext.rb +14 -211
  45. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  46. data/lib/opennebula/oneflow_client.rb +11 -9
  47. data/lib/opennebula/pool.rb +1 -1
  48. data/lib/opennebula/pool_element.rb +1 -1
  49. data/lib/opennebula/security_group.rb +1 -1
  50. data/lib/opennebula/security_group_pool.rb +1 -1
  51. data/lib/opennebula/server_cipher_auth.rb +1 -1
  52. data/lib/opennebula/server_x509_auth.rb +1 -1
  53. data/lib/opennebula/ssh_auth.rb +1 -1
  54. data/lib/opennebula/system.rb +1 -1
  55. data/lib/opennebula/template.rb +1 -1
  56. data/lib/opennebula/template_ext.rb +1 -1
  57. data/lib/opennebula/template_pool.rb +1 -1
  58. data/lib/opennebula/user.rb +1 -1
  59. data/lib/opennebula/user_pool.rb +1 -1
  60. data/lib/opennebula/utils.rb +2 -2
  61. data/lib/opennebula/vdc.rb +1 -1
  62. data/lib/opennebula/vdc_pool.rb +1 -1
  63. data/lib/opennebula/virtual_machine.rb +3 -12
  64. data/lib/opennebula/virtual_machine_ext.rb +2 -31
  65. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  66. data/lib/opennebula/virtual_network.rb +1 -1
  67. data/lib/opennebula/virtual_network_pool.rb +1 -1
  68. data/lib/opennebula/virtual_router.rb +1 -1
  69. data/lib/opennebula/virtual_router_pool.rb +1 -1
  70. data/lib/opennebula/vm_group.rb +1 -1
  71. data/lib/opennebula/vm_group_pool.rb +1 -1
  72. data/lib/opennebula/vntemplate.rb +1 -1
  73. data/lib/opennebula/vntemplate_pool.rb +1 -1
  74. data/lib/opennebula/wait_ext.rb +1 -1
  75. data/lib/opennebula/x509_auth.rb +1 -1
  76. data/lib/opennebula/xml_element.rb +2 -2
  77. data/lib/opennebula/xml_pool.rb +1 -1
  78. data/lib/opennebula/xml_utils.rb +1 -1
  79. data/lib/opennebula/zone.rb +1 -1
  80. data/lib/opennebula/zone_pool.rb +1 -1
  81. data/lib/opennebula.rb +2 -2
  82. metadata +6 -67
  83. data/lib/ActionManager.rb +0 -280
  84. data/lib/CommandManager.rb +0 -328
  85. data/lib/DriverExecHelper.rb +0 -213
  86. data/lib/HostSyncManager.rb +0 -111
  87. data/lib/OpenNebulaDriver.rb +0 -223
  88. data/lib/VirtualMachineDriver.rb +0 -404
  89. data/lib/datacenter.rb +0 -1319
  90. data/lib/datastore.rb +0 -1049
  91. data/lib/distributed_firewall.rb +0 -293
  92. data/lib/file_helper.rb +0 -374
  93. data/lib/host.rb +0 -1518
  94. data/lib/logical_port.rb +0 -50
  95. data/lib/logical_switch.rb +0 -77
  96. data/lib/memoize.rb +0 -74
  97. data/lib/network.rb +0 -705
  98. data/lib/nsx_client.rb +0 -157
  99. data/lib/nsx_component.rb +0 -28
  100. data/lib/nsx_constants.rb +0 -162
  101. data/lib/nsx_driver.rb +0 -91
  102. data/lib/nsx_error.rb +0 -77
  103. data/lib/nsx_rule.rb +0 -206
  104. data/lib/nsxt_client.rb +0 -189
  105. data/lib/nsxt_dfw.rb +0 -196
  106. data/lib/nsxt_logical_port.rb +0 -94
  107. data/lib/nsxt_rule.rb +0 -188
  108. data/lib/nsxt_tz.rb +0 -38
  109. data/lib/nsxv_client.rb +0 -189
  110. data/lib/nsxv_dfw.rb +0 -202
  111. data/lib/nsxv_logical_port.rb +0 -107
  112. data/lib/nsxv_rule.rb +0 -172
  113. data/lib/nsxv_tz.rb +0 -41
  114. data/lib/opaque_network.rb +0 -134
  115. data/lib/rest_client.rb +0 -191
  116. data/lib/scripts_common.rb +0 -176
  117. data/lib/transport_zone.rb +0 -43
  118. data/lib/vcenter_driver.rb +0 -152
  119. data/lib/vcenter_importer.rb +0 -626
  120. data/lib/vi_client.rb +0 -273
  121. data/lib/vi_helper.rb +0 -328
  122. data/lib/virtual_machine.rb +0 -3574
  123. data/lib/virtual_wire.rb +0 -158
  124. data/lib/vm_device.rb +0 -80
  125. data/lib/vm_disk.rb +0 -202
  126. data/lib/vm_folder.rb +0 -69
  127. data/lib/vm_helper.rb +0 -30
  128. data/lib/vm_monitor.rb +0 -305
  129. data/lib/vm_nic.rb +0 -70
  130. data/lib/vm_template.rb +0 -2112
  131. data/lib/vmm_importer.rb +0 -165
@@ -1,404 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
- require 'opennebula'
17
- require "OpenNebulaDriver"
18
- require "CommandManager"
19
- require 'base64'
20
- require 'rexml/document'
21
-
22
- # This class provides basic messaging and logging functionality
23
- # to implement OpenNebula Drivers. A driver is a program that
24
- # specialize the OpenNebula behavior by interfacing with specific
25
- # infrastructure functionalities.
26
- #
27
- # A Driver inherits this class and only has to provide methods
28
- # for each action it wants to receive. The method must be associated
29
- # with the action name through the register_action function
30
- class VirtualMachineDriver < OpenNebulaDriver
31
-
32
- # Virtual Machine Driver Protocol constants
33
- ACTION = {
34
- :deploy => "DEPLOY",
35
- :shutdown => "SHUTDOWN",
36
- :reboot => "REBOOT",
37
- :reset => "RESET",
38
- :cancel => "CANCEL",
39
- :save => "SAVE",
40
- :restore => "RESTORE",
41
- :migrate => "MIGRATE",
42
- :poll => "POLL",
43
- :log => "LOG",
44
- :attach_disk => "ATTACHDISK",
45
- :detach_disk => "DETACHDISK",
46
- :snapshot_create => "SNAPSHOTCREATE",
47
- :snapshot_revert => "SNAPSHOTREVERT",
48
- :snapshot_delete => "SNAPSHOTDELETE",
49
- :cleanup => "CLEANUP",
50
- :attach_nic => "ATTACHNIC",
51
- :detach_nic => "DETACHNIC",
52
- :disk_snapshot_create => "DISKSNAPSHOTCREATE",
53
- :resize_disk => "RESIZEDISK",
54
- :update_sg => "UPDATESG",
55
- :update_conf => "UPDATECONF",
56
- :resize => "RESIZE",
57
- :backup => "BACKUP",
58
- :update_nic => "UPDATENIC",
59
- :backup_cancel=> "BACKUPCANCEL"
60
- }
61
-
62
- POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
63
- VM_STATE = OpenNebula::VirtualMachine::Driver::VM_STATE
64
-
65
- HOST_ARG = 1
66
-
67
- # Register default actions for the protocol.
68
- #
69
- # @param [String] directory path inside remotes path where the scripts
70
- # reside
71
- # @param [Hash] options options for OpenNebula driver (check the available
72
- # options in {OpenNebulaDriver#initialize})
73
- # @option options [Boolean] :threaded (true) enables or disables threads
74
- def initialize(directory, options={})
75
- @options={
76
- :threaded => true,
77
- :single_host => true
78
- }.merge!(options)
79
-
80
- super(directory, @options)
81
-
82
- @hosts = Array.new
83
-
84
- register_action(ACTION[:deploy].to_sym, method("deploy"))
85
- register_action(ACTION[:shutdown].to_sym, method("shutdown"))
86
- register_action(ACTION[:reboot].to_sym, method("reboot"))
87
- register_action(ACTION[:reset].to_sym, method("reset"))
88
- register_action(ACTION[:cancel].to_sym, method("cancel"))
89
- register_action(ACTION[:save].to_sym, method("save"))
90
- register_action(ACTION[:restore].to_sym, method("restore"))
91
- register_action(ACTION[:migrate].to_sym, method("migrate"))
92
- register_action(ACTION[:poll].to_sym, method("poll"))
93
- register_action(ACTION[:attach_disk].to_sym, method("attach_disk"))
94
- register_action(ACTION[:detach_disk].to_sym, method("detach_disk"))
95
- register_action(ACTION[:snapshot_create].to_sym, method("snapshot_create"))
96
- register_action(ACTION[:snapshot_revert].to_sym, method("snapshot_revert"))
97
- register_action(ACTION[:snapshot_delete].to_sym, method("snapshot_delete"))
98
- register_action(ACTION[:cleanup].to_sym, method("cleanup"))
99
- register_action(ACTION[:attach_nic].to_sym, method("attach_nic"))
100
- register_action(ACTION[:detach_nic].to_sym, method("detach_nic"))
101
- register_action(ACTION[:disk_snapshot_create].to_sym, method("disk_snapshot_create"))
102
- register_action(ACTION[:resize_disk].to_sym, method("resize_disk"))
103
- register_action(ACTION[:update_sg].to_sym, method("update_sg"))
104
- register_action(ACTION[:update_conf].to_sym, method("update_conf"))
105
- register_action(ACTION[:resize].to_sym, method("resize"))
106
- register_action(ACTION[:backup].to_sym, method("backup"))
107
- register_action(ACTION[:update_nic].to_sym, method("update_nic"))
108
- register_action(ACTION[:backup_cancel].to_sym, method("backup_cancel"))
109
- end
110
-
111
- # Decodes the encoded XML driver message received from the core
112
- #
113
- # @param [String] drv_message the driver message
114
- # @return [REXML::Element] the root element of the decoded XML message
115
- def decode(drv_message)
116
- message = Base64.decode64(drv_message)
117
- xml_doc = REXML::Document.new(message)
118
-
119
- xml_doc.root
120
- end
121
-
122
- # Execute a command associated to an action and id in a remote host.
123
- def remotes_action(command, id, host, action, remote_dir, std_in=nil)
124
- super(command,id,host,ACTION[action],remote_dir,std_in)
125
- end
126
-
127
- # Execute a command associated to an action and id on localhost
128
- def local_action(command, id, action)
129
- super(command,id,ACTION[action])
130
- end
131
-
132
- # Virtual Machine Manager Protocol Actions (generic implementation)
133
- def deploy(id, drv_message)
134
- error = "Action not implemented by driver #{self.class}"
135
- send_message(ACTION[:deploy],RESULT[:failure],id,error)
136
- end
137
-
138
- def shutdown(id, drv_message)
139
- error = "Action not implemented by driver #{self.class}"
140
- send_message(ACTION[:shutdown],RESULT[:failure],id,error)
141
- end
142
-
143
- def reboot(id, drv_message)
144
- error = "Action not implemented by driver #{self.class}"
145
- send_message(ACTION[:reboot],RESULT[:failure],id,error)
146
- end
147
-
148
- def reset(id, drv_message)
149
- error = "Action not implemented by driver #{self.class}"
150
- send_message(ACTION[:reset],RESULT[:failure],id,error)
151
- end
152
-
153
- def cancel(id, drv_message)
154
- error = "Action not implemented by driver #{self.class}"
155
- send_message(ACTION[:cancel],RESULT[:failure],id,error)
156
- end
157
-
158
- def save(id, drv_message)
159
- error = "Action not implemented by driver #{self.class}"
160
- send_message(ACTION[:save],RESULT[:failure],id,error)
161
- end
162
-
163
- def restore(id, drv_message)
164
- error = "Action not implemented by driver #{self.class}"
165
- send_message(ACTION[:restore],RESULT[:failure],id,error)
166
- end
167
-
168
- def migrate(id, drv_message)
169
- error = "Action not implemented by driver #{self.class}"
170
- send_message(ACTION[:migrate],RESULT[:failure],id,error)
171
- end
172
-
173
- def poll(id, drv_message)
174
- error = "Action not implemented by driver #{self.class}"
175
- send_message(ACTION[:poll],RESULT[:failure],id,error)
176
- end
177
-
178
- def attach_disk(id, drv_message)
179
- error = "Action not implemented by driver #{self.class}"
180
- send_message(ACTION[:attach_disk],RESULT[:failure],id,error)
181
- end
182
-
183
- def detach_disk(id, drv_message)
184
- error = "Action not implemented by driver #{self.class}"
185
- send_message(ACTION[:detach_disk],RESULT[:failure],id,error)
186
- end
187
-
188
- def attach_nic(id, drv_message)
189
- error = "Action not implemented by driver #{self.class}"
190
- send_message(ACTION[:attach_nic],RESULT[:failure],id,error)
191
- end
192
-
193
- def detach_nic(id, drv_message)
194
- error = "Action not implemented by driver #{self.class}"
195
- send_message(ACTION[:detach_nic],RESULT[:failure],id,error)
196
- end
197
-
198
- def snapshot_create(id, drv_message)
199
- error = "Action not implemented by driver #{self.class}"
200
- send_message(ACTION[:snapshot_create],RESULT[:failure],id,error)
201
- end
202
-
203
- def snapshot_revert(id, drv_message)
204
- error = "Action not implemented by driver #{self.class}"
205
- send_message(ACTION[:snapshot_revert],RESULT[:failure],id,error)
206
- end
207
-
208
- def snapshot_delete(id, drv_message)
209
- error = "Action not implemented by driver #{self.class}"
210
- send_message(ACTION[:snapshot_delete],RESULT[:failure],id,error)
211
- end
212
-
213
- def disk_snapshot_create(id, drv_message)
214
- error = "Action not implemented by driver #{self.class}"
215
- send_message(ACTION[:disk_snapshot_create],RESULT[:failure],id,error)
216
- end
217
-
218
- def resize_disk(id, drv_message)
219
- error = "Action not implemented by driver #{self.class}"
220
- send_message(ACTION[:resize_disk],RESULT[:failure],id,error)
221
- end
222
-
223
- def update_sg(id, drv_message)
224
- error = "Action not implemented by driver #{self.class}"
225
- send_message(ACTION[:update_sg],RESULT[:failure],id,error)
226
- end
227
-
228
- def cleanup(id, drv_message)
229
- error = "Action not implemented by driver #{self.class}"
230
- send_message(ACTION[:cleanup],RESULT[:failure],id,error)
231
- end
232
-
233
- def update_conf(id, drv_message)
234
- error = "Action not implemented by driver #{self.class}"
235
- send_message(ACTION[:update_conf],RESULT[:failure],id,error)
236
- end
237
-
238
- def resize(id, drv_message)
239
- error = "Action not implemented by driver #{self.class}"
240
- send_message(ACTION[:resize],RESULT[:failure],id,error)
241
- end
242
-
243
- def backup(id, drv_message)
244
- error = "Action not implemented by driver #{self.class}"
245
- send_message(ACTION[:backup],RESULT[:failure],id,error)
246
- end
247
-
248
- def update_nic(id, drv_message)
249
- error = "Action not implemented by driver #{self.class}"
250
- send_message(ACTION[:update_nic],RESULT[:failure],id,error)
251
- end
252
-
253
- def backup_cancel(id, drv_message)
254
- error = "Action not implemented by driver #{self.class}"
255
- send_message(ACTION[:backup_cancel],RESULT[:failure],id,error)
256
- end
257
-
258
- private
259
-
260
- # Interface to handle the pending events from the ActionManager Interface
261
- def delete_running_action(action_id)
262
- if @options[:single_host]
263
- delete_running_action_single_host(action_id)
264
- else
265
- super(action_id)
266
- end
267
- end
268
-
269
- def delete_running_action_single_host(action_id)
270
- action=@action_running[action_id]
271
- if action
272
- @hosts.delete(action[:host])
273
- @action_running.delete(action_id)
274
- end
275
- end
276
-
277
- def get_first_runable
278
- if @options[:single_host]
279
- get_first_runable_single_host
280
- else
281
- super
282
- end
283
- end
284
-
285
- def get_first_runable_single_host
286
- action_index=nil
287
- @action_queue.each_with_index do |action, index|
288
- if !action.keys.include?(:host)
289
- if action[:args].length == 2
290
- begin
291
- xml=decode(action[:args].last)
292
- host=xml.elements['HOST']
293
- action[:host]=host.text if host
294
- rescue
295
- action[:host]=nil
296
- end
297
- else
298
- action[:host]=nil
299
- end
300
- end
301
-
302
- if action.keys.include?(:host) && action[:host]
303
- if !@hosts.include?(action[:host])
304
- action_index=index
305
- break
306
- end
307
- else
308
- action_index=index
309
- break
310
- end
311
- end
312
-
313
- return action_index
314
- end
315
-
316
- def get_runable_action
317
- if @options[:single_host]
318
- get_runable_action_single_host
319
- else
320
- super
321
- end
322
- end
323
-
324
- def get_runable_action_single_host
325
- action_index=get_first_runable
326
-
327
- if action_index
328
- action=@action_queue[action_index]
329
- else
330
- action=nil
331
- end
332
-
333
- if action
334
- @hosts << action[:host] if action[:host]
335
- @action_queue.delete_at(action_index)
336
- end
337
-
338
- return action
339
- end
340
-
341
- def empty_queue
342
- if @options[:single_host]
343
- empty_queue_single_host
344
- else
345
- super
346
- end
347
- end
348
-
349
- def empty_queue_single_host
350
- get_first_runable==nil
351
- end
352
- end
353
-
354
- ################################################################
355
- ################################################################
356
-
357
- if __FILE__ == $0
358
-
359
- class TemplateDriver < VirtualMachineDriver
360
- def initialize
361
- super('vmm/dummy',
362
- :concurrency => 15,
363
- :threaded => true)
364
- end
365
-
366
- def deploy(id, host, remote_dfile, not_used)
367
- #MUST return deploy_id if deployment was successfull
368
- deploy_id = "-"
369
- send_message(ACTION[:deploy],RESULT[:success],id,deploy_id)
370
- end
371
-
372
- def shutdown(id, host, deploy_id, not_used)
373
- send_message(ACTION[:shutdown],RESULT[:success],id)
374
- end
375
-
376
- def cancel(id, host, deploy_id, not_used)
377
- send_message(ACTION[:cancel],RESULT[:success],id)
378
- end
379
-
380
- def save(id, host, deploy_id, file)
381
- send_message(ACTION[:save],RESULT[:success],id)
382
- end
383
-
384
- def restore(id, host, deploy_id , file)
385
- send_message(ACTION[:restore],RESULT[:success],id)
386
- end
387
-
388
- def migrate(id, host, deploy_id, dest_host)
389
- send_message(ACTION[:migrate],RESULT[:success],id)
390
- end
391
-
392
- def poll(id, host, deploy_id, not_used)
393
- # monitor_info: string in the form "VAR=VAL VAR=VAL ... VAR=VAL"
394
- # known VAR are in POLL_ATTRIBUTES. VM states VM_STATES
395
- monitor_info = "#{POLL_ATTRIBUTE[:state]}=#{VM_STATE[:active]} " \
396
- "#{POLL_ATTRIBUTE[:nettx]}=12345"
397
-
398
- send_message(ACTION[:poll],RESULT[:success],id,monitor_info)
399
- end
400
- end
401
-
402
- sd = TemplateDriver.new
403
- sd.start_driver
404
- end