opennebula 6.2.2 → 6.3.90.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.
- checksums.yaml +4 -4
- data/lib/ActionManager.rb +1 -1
- data/lib/CommandManager.rb +1 -1
- data/lib/DriverExecHelper.rb +1 -1
- data/lib/OpenNebulaDriver.rb +1 -1
- data/lib/VirtualMachineDriver.rb +1 -1
- data/lib/cloud/CloudClient.rb +3 -3
- data/lib/datacenter.rb +1 -1
- data/lib/datastore.rb +2 -2
- data/lib/distributed_firewall.rb +1 -1
- data/lib/file_helper.rb +2 -2
- data/lib/host.rb +1 -1
- data/lib/logical_port.rb +1 -1
- data/lib/logical_switch.rb +1 -1
- data/lib/memoize.rb +1 -1
- data/lib/models/role.rb +74 -3
- data/lib/models/service.rb +122 -56
- data/lib/models.rb +1 -1
- data/lib/network.rb +1 -1
- data/lib/nsx_client.rb +1 -1
- data/lib/nsx_component.rb +1 -1
- data/lib/nsx_constants.rb +1 -1
- data/lib/nsx_driver.rb +1 -1
- data/lib/nsx_error.rb +1 -1
- data/lib/nsx_rule.rb +1 -1
- data/lib/nsxt_client.rb +1 -1
- data/lib/nsxt_dfw.rb +1 -1
- data/lib/nsxt_logical_port.rb +1 -1
- data/lib/nsxt_rule.rb +1 -1
- data/lib/nsxt_tz.rb +1 -1
- data/lib/nsxv_client.rb +1 -1
- data/lib/nsxv_dfw.rb +1 -1
- data/lib/nsxv_logical_port.rb +1 -1
- data/lib/nsxv_rule.rb +1 -1
- data/lib/nsxv_tz.rb +1 -1
- data/lib/opaque_network.rb +1 -1
- data/lib/opennebula/acl.rb +1 -1
- data/lib/opennebula/acl_pool.rb +1 -1
- data/lib/opennebula/client.rb +1 -1
- data/lib/opennebula/cluster.rb +1 -1
- data/lib/opennebula/cluster_pool.rb +1 -1
- data/lib/opennebula/datastore.rb +1 -1
- data/lib/opennebula/datastore_pool.rb +1 -1
- data/lib/opennebula/document.rb +1 -1
- data/lib/opennebula/document_json.rb +1 -1
- data/lib/opennebula/document_pool.rb +1 -1
- data/lib/opennebula/document_pool_json.rb +1 -1
- data/lib/opennebula/error.rb +1 -1
- data/lib/opennebula/flow/grammar.rb +1 -1
- data/lib/opennebula/flow/service_pool.rb +1 -1
- data/lib/opennebula/flow/service_template.rb +9 -1
- data/lib/opennebula/flow/service_template_ext.rb +1 -1
- data/lib/opennebula/flow/service_template_pool.rb +1 -1
- data/lib/opennebula/flow/validator.rb +1 -1
- data/lib/opennebula/flow.rb +1 -1
- data/lib/opennebula/group.rb +1 -1
- data/lib/opennebula/group_pool.rb +1 -1
- data/lib/opennebula/hook.rb +1 -1
- data/lib/opennebula/hook_log.rb +1 -1
- data/lib/opennebula/hook_pool.rb +1 -1
- data/lib/opennebula/host.rb +1 -1
- data/lib/opennebula/host_pool.rb +1 -1
- data/lib/opennebula/image.rb +1 -1
- data/lib/opennebula/image_pool.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +1 -1
- data/lib/opennebula/ldap_auth_spec.rb +1 -1
- data/lib/opennebula/lockable_ext.rb +1 -1
- data/lib/opennebula/marketplace.rb +1 -1
- data/lib/opennebula/marketplace_pool.rb +1 -1
- data/lib/opennebula/marketplaceapp.rb +1 -1
- data/lib/opennebula/marketplaceapp_ext.rb +27 -10
- data/lib/opennebula/marketplaceapp_pool.rb +1 -1
- data/lib/opennebula/oneflow_client.rb +37 -25
- data/lib/opennebula/pool.rb +1 -1
- data/lib/opennebula/pool_element.rb +1 -1
- data/lib/opennebula/security_group.rb +1 -1
- data/lib/opennebula/security_group_pool.rb +1 -1
- data/lib/opennebula/server_cipher_auth.rb +1 -1
- data/lib/opennebula/server_x509_auth.rb +1 -1
- data/lib/opennebula/ssh_auth.rb +1 -1
- data/lib/opennebula/system.rb +1 -1
- data/lib/opennebula/template.rb +1 -1
- data/lib/opennebula/template_ext.rb +1 -1
- data/lib/opennebula/template_pool.rb +1 -1
- data/lib/opennebula/user.rb +1 -1
- data/lib/opennebula/user_pool.rb +1 -1
- data/lib/opennebula/utils.rb +1 -1
- data/lib/opennebula/vdc.rb +1 -1
- data/lib/opennebula/vdc_pool.rb +1 -1
- data/lib/opennebula/virtual_machine.rb +27 -2
- data/lib/opennebula/virtual_machine_ext.rb +1 -1
- data/lib/opennebula/virtual_machine_pool.rb +1 -1
- data/lib/opennebula/virtual_network.rb +39 -2
- data/lib/opennebula/virtual_network_pool.rb +1 -1
- data/lib/opennebula/virtual_router.rb +1 -1
- data/lib/opennebula/virtual_router_pool.rb +1 -1
- data/lib/opennebula/vm_group.rb +1 -1
- data/lib/opennebula/vm_group_pool.rb +1 -1
- data/lib/opennebula/vntemplate.rb +1 -1
- data/lib/opennebula/vntemplate_pool.rb +1 -1
- data/lib/opennebula/wait_ext.rb +1 -1
- data/lib/opennebula/x509_auth.rb +1 -1
- data/lib/opennebula/xml_element.rb +1 -1
- data/lib/opennebula/xml_pool.rb +1 -1
- data/lib/opennebula/xml_utils.rb +1 -1
- data/lib/opennebula/zone.rb +1 -1
- data/lib/opennebula/zone_pool.rb +1 -1
- data/lib/opennebula.rb +2 -2
- data/lib/rest_client.rb +1 -1
- data/lib/scripts_common.rb +1 -1
- data/lib/transport_zone.rb +1 -1
- data/lib/vcenter_driver.rb +1 -1
- data/lib/vcenter_importer.rb +1 -12
- data/lib/vi_client.rb +1 -1
- data/lib/vi_helper.rb +7 -2
- data/lib/virtual_machine.rb +10 -5
- data/lib/virtual_wire.rb +1 -1
- data/lib/vm_disk.rb +1 -1
- data/lib/vm_folder.rb +1 -1
- data/lib/vm_helper.rb +1 -1
- data/lib/vm_monitor.rb +5 -1
- data/lib/vm_nic.rb +1 -1
- data/lib/vm_template.rb +45 -23
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce0ca66d3a7fc700e855f98615b22498966c4efb6321770afc9e5852d29359c2
|
|
4
|
+
data.tar.gz: 7879f4859708352f9d1a69edd76ed6131ec8c3a26470ebea6933fb02317f948f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff3757f8da05cd268b1fcdd153e9e1dabb502ac3269567d2d66c1161e0d5014641d0ccd2776a8cb6b924a6d076d01b28730a38d4095c3655d14728805120450a
|
|
7
|
+
data.tar.gz: ede0e55b1b5b3423e22dc73832ead4e300857c41551f79cd921d427aaba9e1a331f1f8763ef8fecbe3bdcad8cc8a122ba8ba1b4aec0f4c51bd3c0486178c06c8
|
data/lib/ActionManager.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- */
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
|
4
4
|
# not use this file except in compliance with the License. You may obtain */
|
|
5
5
|
# a copy of the License at */
|
data/lib/CommandManager.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# --------------------------------------------------------------------------
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain
|
data/lib/DriverExecHelper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rubocop:disable Naming/FileName
|
|
2
2
|
# -------------------------------------------------------------------------- #
|
|
3
|
-
# Copyright 2002-
|
|
3
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
4
4
|
# #
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
6
6
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/OpenNebulaDriver.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/VirtualMachineDriver.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/cloud/CloudClient.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -51,7 +51,7 @@ end
|
|
|
51
51
|
module CloudClient
|
|
52
52
|
|
|
53
53
|
# OpenNebula version
|
|
54
|
-
VERSION = '6.
|
|
54
|
+
VERSION = '6.3.90'
|
|
55
55
|
|
|
56
56
|
# #########################################################################
|
|
57
57
|
# Default location for the authentication file
|
|
@@ -229,7 +229,7 @@ module CloudCLI
|
|
|
229
229
|
def version_text
|
|
230
230
|
version=<<EOT
|
|
231
231
|
OpenNebula #{CloudClient::VERSION}
|
|
232
|
-
Copyright 2002-
|
|
232
|
+
Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
|
|
233
233
|
|
|
234
234
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
235
235
|
not use this file except in compliance with the License. You may obtain
|
data/lib/datacenter.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/datastore.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -561,7 +561,7 @@ module VCenterDriver
|
|
|
561
561
|
rescue StandardError => e
|
|
562
562
|
message = "Could not find file. Reason: \"#{e.message}\"."
|
|
563
563
|
if VCenterDriver::CONFIG[:debug_information]
|
|
564
|
-
message += ' ' + e.backtrace
|
|
564
|
+
message += ' ' + e.backtrace.to_s
|
|
565
565
|
end
|
|
566
566
|
raise message
|
|
567
567
|
end
|
data/lib/distributed_firewall.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/file_helper.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -98,7 +98,7 @@ module VCenterDriver
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def self.get_type(file)
|
|
101
|
-
type = `file -b --mime-type #{file}`
|
|
101
|
+
type = `file -P bytes=256 -b --mime-type #{file}`
|
|
102
102
|
if $?.exitstatus != 0 # rubocop:disable Style/SpecialGlobalVars
|
|
103
103
|
STDERR.puts "Can not read file #{file}"
|
|
104
104
|
exit(-1)
|
data/lib/host.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/logical_port.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/logical_switch.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/memoize.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/models/role.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -65,7 +65,8 @@ module OpenNebula
|
|
|
65
65
|
'FAILED_DEPLOYING' => 7,
|
|
66
66
|
'SCALING' => 8,
|
|
67
67
|
'FAILED_SCALING' => 9,
|
|
68
|
-
'COOLDOWN' => 10
|
|
68
|
+
'COOLDOWN' => 10,
|
|
69
|
+
'HOLD' => 11
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
STATE_STR = %w[
|
|
@@ -80,6 +81,7 @@ module OpenNebula
|
|
|
80
81
|
SCALING
|
|
81
82
|
FAILED_SCALING
|
|
82
83
|
COOLDOWN
|
|
84
|
+
HOLD
|
|
83
85
|
]
|
|
84
86
|
|
|
85
87
|
RECOVER_DEPLOY_STATES = %w[
|
|
@@ -147,6 +149,7 @@ module OpenNebula
|
|
|
147
149
|
|
|
148
150
|
@body['cooldown'] = @@default_cooldown if @body['cooldown'].nil?
|
|
149
151
|
@body['nodes'] ||= []
|
|
152
|
+
@body['on_hold'] = false if @body['on_hold'].nil?
|
|
150
153
|
end
|
|
151
154
|
|
|
152
155
|
def name
|
|
@@ -195,12 +198,25 @@ module OpenNebula
|
|
|
195
198
|
true
|
|
196
199
|
end
|
|
197
200
|
|
|
201
|
+
def can_release?
|
|
202
|
+
state == STATE['HOLD']
|
|
203
|
+
end
|
|
204
|
+
|
|
198
205
|
# Returns the role parents
|
|
199
206
|
# @return [Array] the role parents
|
|
200
207
|
def parents
|
|
201
208
|
@body['parents'] || []
|
|
202
209
|
end
|
|
203
210
|
|
|
211
|
+
def any_parent_on_hold?
|
|
212
|
+
parents.each do |parent|
|
|
213
|
+
next unless @service.roles[parent]
|
|
214
|
+
|
|
215
|
+
return true if @service.roles[parent].on_hold?
|
|
216
|
+
end
|
|
217
|
+
false
|
|
218
|
+
end
|
|
219
|
+
|
|
204
220
|
# Returns the role cardinality
|
|
205
221
|
# @return [Integer] the role cardinality
|
|
206
222
|
def cardinality
|
|
@@ -357,6 +373,23 @@ module OpenNebula
|
|
|
357
373
|
@body.delete('scale_way')
|
|
358
374
|
end
|
|
359
375
|
|
|
376
|
+
# Returns the on_hold role option
|
|
377
|
+
# @return [true, false] true if the on_hold option is enabled
|
|
378
|
+
def on_hold?
|
|
379
|
+
@body['on_hold']
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
# Returns the on_hold service option
|
|
383
|
+
# @return [true, false] true if the on_hold option is enabled
|
|
384
|
+
def service_on_hold?
|
|
385
|
+
@service.on_hold?
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# Set the on_hold vm option to true
|
|
389
|
+
def hold(hold)
|
|
390
|
+
@body['on_hold'] = hold
|
|
391
|
+
end
|
|
392
|
+
|
|
360
393
|
# Retrieves the VM information for each Node in this Role. If a Node
|
|
361
394
|
# is to be disposed and it is found in DONE, it will be cleaned
|
|
362
395
|
#
|
|
@@ -436,7 +469,7 @@ module OpenNebula
|
|
|
436
469
|
"template #{template_id}, with name #{vm_name}",
|
|
437
470
|
@service.id
|
|
438
471
|
|
|
439
|
-
vm_id = template.instantiate(vm_name,
|
|
472
|
+
vm_id = template.instantiate(vm_name, on_hold?, extra_template)
|
|
440
473
|
|
|
441
474
|
deployed_nodes << vm_id
|
|
442
475
|
|
|
@@ -546,6 +579,44 @@ module OpenNebula
|
|
|
546
579
|
[true, nil]
|
|
547
580
|
end
|
|
548
581
|
|
|
582
|
+
# Release all the nodes in this role
|
|
583
|
+
# @return [Array, Bool] true if all the VMs
|
|
584
|
+
# were released, false otherwise and Array with VMs released
|
|
585
|
+
def release
|
|
586
|
+
release_nodes = []
|
|
587
|
+
success = true
|
|
588
|
+
|
|
589
|
+
# Release all vms in the role
|
|
590
|
+
nodes.each do |node|
|
|
591
|
+
vm_id = node['deploy_id']
|
|
592
|
+
|
|
593
|
+
Log.debug(LOG_COMP,
|
|
594
|
+
"Role #{name}: Releasing VM #{vm_id}",
|
|
595
|
+
@service.id)
|
|
596
|
+
|
|
597
|
+
vm = OpenNebula::VirtualMachine.new_with_id(vm_id,
|
|
598
|
+
@service.client)
|
|
599
|
+
rc = vm.release
|
|
600
|
+
|
|
601
|
+
if OpenNebula.is_error?(rc)
|
|
602
|
+
msg = "Role #{name}: Release failed for VM #{vm_id}, " \
|
|
603
|
+
"#{rc.message}"
|
|
604
|
+
|
|
605
|
+
Log.error(LOG_COMP, msg, @service.id)
|
|
606
|
+
@service.log_error(msg)
|
|
607
|
+
success = false
|
|
608
|
+
else
|
|
609
|
+
Log.debug(LOG_COMP,
|
|
610
|
+
"Role #{name}: Release success for VM #{vm_id}",
|
|
611
|
+
@service.id)
|
|
612
|
+
|
|
613
|
+
release_nodes << vm_id
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
[release_nodes, success]
|
|
618
|
+
end
|
|
619
|
+
|
|
549
620
|
# Schedule the given action on all the VMs that belong to the Role
|
|
550
621
|
# @param [String] action one of the available SCHEDULE_ACTIONS
|
|
551
622
|
# @param [Integer] period
|
data/lib/models/service.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -24,17 +24,22 @@ module OpenNebula
|
|
|
24
24
|
DOCUMENT_TYPE = 100
|
|
25
25
|
|
|
26
26
|
STATE = {
|
|
27
|
-
'PENDING'
|
|
28
|
-
'DEPLOYING'
|
|
29
|
-
'RUNNING'
|
|
30
|
-
'UNDEPLOYING'
|
|
31
|
-
'WARNING'
|
|
32
|
-
'DONE'
|
|
33
|
-
'FAILED_UNDEPLOYING'
|
|
34
|
-
'FAILED_DEPLOYING'
|
|
35
|
-
'SCALING'
|
|
36
|
-
'FAILED_SCALING'
|
|
37
|
-
'COOLDOWN'
|
|
27
|
+
'PENDING' => 0,
|
|
28
|
+
'DEPLOYING' => 1,
|
|
29
|
+
'RUNNING' => 2,
|
|
30
|
+
'UNDEPLOYING' => 3,
|
|
31
|
+
'WARNING' => 4,
|
|
32
|
+
'DONE' => 5,
|
|
33
|
+
'FAILED_UNDEPLOYING' => 6,
|
|
34
|
+
'FAILED_DEPLOYING' => 7,
|
|
35
|
+
'SCALING' => 8,
|
|
36
|
+
'FAILED_SCALING' => 9,
|
|
37
|
+
'COOLDOWN' => 10,
|
|
38
|
+
'DEPLOYING_NETS' => 11,
|
|
39
|
+
'UNDEPLOYING_NETS' => 12,
|
|
40
|
+
'FAILED_DEPLOYING_NETS' => 13,
|
|
41
|
+
'FAILED_UNDEPLOYING_NETS' => 14,
|
|
42
|
+
'HOLD' => 15
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
STATE_STR = %w[
|
|
@@ -49,6 +54,11 @@ module OpenNebula
|
|
|
49
54
|
SCALING
|
|
50
55
|
FAILED_SCALING
|
|
51
56
|
COOLDOWN
|
|
57
|
+
DEPLOYING_NETS
|
|
58
|
+
UNDEPLOYING_NETS
|
|
59
|
+
FAILED_DEPLOYING_NETS
|
|
60
|
+
FAILED_UNDEPLOYING_NETS
|
|
61
|
+
HOLD
|
|
52
62
|
]
|
|
53
63
|
|
|
54
64
|
TRANSIENT_STATES = %w[
|
|
@@ -56,12 +66,16 @@ module OpenNebula
|
|
|
56
66
|
UNDEPLOYING
|
|
57
67
|
SCALING
|
|
58
68
|
COOLDOWN
|
|
69
|
+
DEPLOYING_NETS
|
|
70
|
+
UNDEPLOYING_NETS
|
|
59
71
|
]
|
|
60
72
|
|
|
61
73
|
FAILED_STATES = %w[
|
|
62
74
|
FAILED_DEPLOYING
|
|
63
75
|
FAILED_UNDEPLOYING
|
|
64
76
|
FAILED_SCALING
|
|
77
|
+
FAILED_DEPLOYING_NETS
|
|
78
|
+
FAILED_UNDEPLOYING_NETS
|
|
65
79
|
]
|
|
66
80
|
|
|
67
81
|
RECOVER_DEPLOY_STATES = %w[
|
|
@@ -73,6 +87,7 @@ module OpenNebula
|
|
|
73
87
|
RECOVER_UNDEPLOY_STATES = %w[
|
|
74
88
|
FAILED_UNDEPLOYING
|
|
75
89
|
UNDEPLOYING
|
|
90
|
+
FAILED_UNDEPLOYING_NETS
|
|
76
91
|
]
|
|
77
92
|
|
|
78
93
|
RECOVER_SCALE_STATES = %w[
|
|
@@ -80,6 +95,13 @@ module OpenNebula
|
|
|
80
95
|
SCALING
|
|
81
96
|
]
|
|
82
97
|
|
|
98
|
+
RECOVER_DEPLOY_NETS_STATES = %w[DEPLOYING_NETS FAILED_DEPLOYING_NETS]
|
|
99
|
+
|
|
100
|
+
RECOVER_UNDEPLOY_NETS_STATES = %w[
|
|
101
|
+
UNDEPLOYING_NETS
|
|
102
|
+
FAILED_UNDEPLOYING_NETS
|
|
103
|
+
]
|
|
104
|
+
|
|
83
105
|
# List of attributes that can't be changed in update operation
|
|
84
106
|
#
|
|
85
107
|
# custom_attrs: it only has sense when deploying, not in running
|
|
@@ -168,6 +190,14 @@ module OpenNebula
|
|
|
168
190
|
RECOVER_SCALE_STATES.include? STATE_STR[state]
|
|
169
191
|
end
|
|
170
192
|
|
|
193
|
+
def can_recover_deploy_nets?
|
|
194
|
+
RECOVER_DEPLOY_NETS_STATES.include?(STATE_STR[state])
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def can_recover_undeploy_nets?
|
|
198
|
+
RECOVER_UNDEPLOY_NETS_STATES.include?(STATE_STR[state])
|
|
199
|
+
end
|
|
200
|
+
|
|
171
201
|
# Return true if the service is running
|
|
172
202
|
# @return true if the service is runnning, false otherwise
|
|
173
203
|
def running?
|
|
@@ -188,6 +218,16 @@ module OpenNebula
|
|
|
188
218
|
self['GID'].to_i
|
|
189
219
|
end
|
|
190
220
|
|
|
221
|
+
# Returns the on_hold service option
|
|
222
|
+
# @return [true, false] true if the on_hold option is enabled
|
|
223
|
+
def on_hold?
|
|
224
|
+
@body['on_hold']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def hold?
|
|
228
|
+
state_str == 'HOLD'
|
|
229
|
+
end
|
|
230
|
+
|
|
191
231
|
# Replaces this object's client with a new one
|
|
192
232
|
# @param [OpenNebula::Client] owner_client the new client
|
|
193
233
|
def replace_client(owner_client)
|
|
@@ -237,6 +277,36 @@ module OpenNebula
|
|
|
237
277
|
true
|
|
238
278
|
end
|
|
239
279
|
|
|
280
|
+
# Returns true if all the nodes are in hold state
|
|
281
|
+
# @return [true, false] true if all the nodes are in hold state
|
|
282
|
+
def all_roles_hold?
|
|
283
|
+
@roles.each do |_name, role|
|
|
284
|
+
if role.state != Role::STATE['HOLD']
|
|
285
|
+
return false
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
true
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Returns virtual networks IDs
|
|
293
|
+
# @return [Array] Array of integers containing the IDs
|
|
294
|
+
def networks(deploy)
|
|
295
|
+
ret = []
|
|
296
|
+
|
|
297
|
+
return ret unless @body['networks_values']
|
|
298
|
+
|
|
299
|
+
@body['networks_values'].each do |vnet|
|
|
300
|
+
vnet.each do |_, net|
|
|
301
|
+
next if net.keys.first == 'id' && !deploy
|
|
302
|
+
|
|
303
|
+
ret << net['id'].to_i
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
ret
|
|
308
|
+
end
|
|
309
|
+
|
|
240
310
|
# Create a new service based on the template provided
|
|
241
311
|
# @param [String] template_json
|
|
242
312
|
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
|
@@ -570,17 +640,22 @@ module OpenNebula
|
|
|
570
640
|
|
|
571
641
|
return if body['networks_values'].nil?
|
|
572
642
|
|
|
573
|
-
body['networks_values'].each do |
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
643
|
+
body['networks_values'].each do |vnet|
|
|
644
|
+
vnet.each do |name, net|
|
|
645
|
+
key = net.keys.first
|
|
646
|
+
|
|
647
|
+
case key
|
|
648
|
+
when 'id'
|
|
649
|
+
next
|
|
650
|
+
when 'template_id'
|
|
651
|
+
rc = create_vnet(name, net)
|
|
652
|
+
when 'reserve_from'
|
|
653
|
+
rc = reserve(name, net)
|
|
654
|
+
end
|
|
579
655
|
|
|
580
|
-
|
|
656
|
+
return rc if OpenNebula.is_error?(rc)
|
|
581
657
|
|
|
582
|
-
|
|
583
|
-
return rc
|
|
658
|
+
net['id'] = rc
|
|
584
659
|
end
|
|
585
660
|
end if deploy
|
|
586
661
|
|
|
@@ -593,22 +668,25 @@ module OpenNebula
|
|
|
593
668
|
end
|
|
594
669
|
|
|
595
670
|
def delete_networks
|
|
596
|
-
vnets
|
|
671
|
+
vnets = @body['networks_values']
|
|
597
672
|
vnets_failed = []
|
|
598
673
|
|
|
599
674
|
return if vnets.nil?
|
|
600
675
|
|
|
601
676
|
vnets.each do |vnet|
|
|
602
|
-
|
|
603
|
-
|
|
677
|
+
vnet.each do |_, net|
|
|
678
|
+
key = net.keys.first
|
|
679
|
+
|
|
680
|
+
next unless %w[template_id reserve_from].include?(key)
|
|
604
681
|
|
|
605
|
-
|
|
682
|
+
rc = OpenNebula::VirtualNetwork.new_with_id(
|
|
683
|
+
net['id'],
|
|
684
|
+
@client
|
|
685
|
+
).delete
|
|
606
686
|
|
|
607
|
-
|
|
608
|
-
.new_with_id(vnet_id, @client).delete
|
|
687
|
+
next unless OpenNebula.is_error?(rc)
|
|
609
688
|
|
|
610
|
-
|
|
611
|
-
vnets_failed << vnet_id
|
|
689
|
+
vnets_failed << net['id']
|
|
612
690
|
end
|
|
613
691
|
end
|
|
614
692
|
|
|
@@ -677,44 +755,32 @@ module OpenNebula
|
|
|
677
755
|
@body['log'] = @body['log'].last(MAX_LOG)
|
|
678
756
|
end
|
|
679
757
|
|
|
680
|
-
def create_vnet(net)
|
|
758
|
+
def create_vnet(name, net)
|
|
681
759
|
extra = ''
|
|
760
|
+
extra = net['extra'] if net.key? 'extra'
|
|
682
761
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
.to_i, @client).instantiate(get_vnet_name(net), extra)
|
|
688
|
-
|
|
689
|
-
# TODO, check which error should be returned
|
|
690
|
-
return vntmpl_id if OpenNebula.is_error?(vntmpl_id)
|
|
691
|
-
|
|
692
|
-
net[net.keys[0]]['id'] = vntmpl_id
|
|
693
|
-
|
|
694
|
-
true
|
|
762
|
+
OpenNebula::VNTemplate.new_with_id(
|
|
763
|
+
net['template_id'].to_i,
|
|
764
|
+
@client
|
|
765
|
+
).instantiate(get_vnet_name(name), extra)
|
|
695
766
|
end
|
|
696
767
|
|
|
697
|
-
def reserve(net)
|
|
698
|
-
|
|
699
|
-
extra = net[
|
|
768
|
+
def reserve(name, net)
|
|
769
|
+
extra = ''
|
|
770
|
+
extra = net['extra'] if net.key? 'extra'
|
|
700
771
|
|
|
701
772
|
return false if !extra || extra.empty?
|
|
702
773
|
|
|
703
|
-
extra.concat("\nNAME=\"#{get_vnet_name(
|
|
704
|
-
|
|
705
|
-
reserve_id = OpenNebula::VirtualNetwork
|
|
706
|
-
.new_with_id(net[net.keys[0]]['reserve_from']
|
|
707
|
-
.to_i, @client).reserve_with_extra(extra)
|
|
708
|
-
|
|
709
|
-
return reserve_id if OpenNebula.is_error?(reserve_id)
|
|
774
|
+
extra.concat("\nNAME=\"#{get_vnet_name(name)}\"\n")
|
|
710
775
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
776
|
+
OpenNebula::VirtualNetwork.new_with_id(
|
|
777
|
+
net['reserve_from'].to_i,
|
|
778
|
+
@client
|
|
779
|
+
).reserve_with_extra(extra)
|
|
714
780
|
end
|
|
715
781
|
|
|
716
782
|
def get_vnet_name(net)
|
|
717
|
-
"#{net
|
|
783
|
+
"#{net}-#{id}"
|
|
718
784
|
end
|
|
719
785
|
|
|
720
786
|
def resolve_attributes(template)
|
data/lib/models.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/network.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_client.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_component.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_constants.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_driver.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ---------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_error.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsx_rule.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/nsxt_client.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|