opennebula 6.4.7 → 6.5.80.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 +10 -7
- data/lib/DriverExecHelper.rb +8 -4
- data/lib/OpenNebulaDriver.rb +1 -1
- data/lib/VirtualMachineDriver.rb +28 -14
- data/lib/cloud/CloudClient.rb +3 -3
- data/lib/datacenter.rb +25 -21
- data/lib/datastore.rb +4 -4
- data/lib/distributed_firewall.rb +1 -1
- data/lib/file_helper.rb +2 -2
- data/lib/host.rb +3 -3
- 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 +116 -70
- data/lib/models/service.rb +58 -58
- 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 +2 -2
- 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 +3 -3
- data/lib/opennebula/cluster.rb +1 -1
- data/lib/opennebula/cluster_pool.rb +1 -1
- data/lib/opennebula/datastore.rb +4 -3
- 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 +22 -22
- data/lib/opennebula/flow/service_template_ext.rb +2 -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 +33 -23
- data/lib/opennebula/image_pool.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +4 -4
- 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 +4 -4
- data/lib/opennebula/marketplaceapp_pool.rb +1 -1
- data/lib/opennebula/oneflow_client.rb +5 -8
- 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 +80 -103
- data/lib/opennebula/system.rb +1 -1
- data/lib/opennebula/template.rb +1 -1
- data/lib/opennebula/template_ext.rb +3 -3
- 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 +31 -3
- data/lib/opennebula/virtual_machine_ext.rb +12 -217
- data/lib/opennebula/virtual_machine_pool.rb +1 -1
- data/lib/opennebula/virtual_network.rb +33 -4
- 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 +2 -2
- 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 +25 -15
- data/lib/scripts_common.rb +4 -1
- data/lib/transport_zone.rb +1 -1
- data/lib/vcenter_driver.rb +1 -1
- data/lib/vcenter_importer.rb +1 -1
- data/lib/vi_client.rb +76 -68
- data/lib/vi_helper.rb +1 -1
- data/lib/virtual_machine.rb +4 -10
- data/lib/virtual_wire.rb +2 -2
- 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 +1 -1
- data/lib/vm_nic.rb +1 -1
- data/lib/vm_template.rb +7 -2
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cb427e39e8e2f581076e069b21c0da24b5e82dac56e29b0e7017c7e419b3a31
|
|
4
|
+
data.tar.gz: 59203c99872a0065565a336a0bc814f5f7f9acd15a79bcdf3e1df9c92f3b5209
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c20a43d2ade283e63fda2143c9fb8fc2d88f7191e81f75f17219d0d625c99f587f6aea2517dfde44d1dd65aea08c65fa349518045a58df2f912d3d7bc5afb197
|
|
7
|
+
data.tar.gz: 7e4f2365737cf9746b91834ff0af8cb01ff7dc198b5f143686d483f6c9aa927df6cbac4e4226682ce599c5afea85be716e2cb21dc2144986e288f8f2f33e5bbb
|
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
|
|
@@ -212,19 +212,22 @@ end
|
|
|
212
212
|
# Executes commands in a remote machine ussing ssh. See documentation
|
|
213
213
|
# for GenericCommand
|
|
214
214
|
class SSHCommand < GenericCommand
|
|
215
|
-
|
|
215
|
+
|
|
216
|
+
attr_accessor :host, :ssh_opts
|
|
216
217
|
|
|
217
218
|
# Creates a command and runs it
|
|
218
|
-
def self.run(command, host, logger=nil, stdin=nil, timeout=nil)
|
|
219
|
-
cmd=self.new(command, host, logger, stdin, timeout)
|
|
219
|
+
def self.run(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
|
|
220
|
+
cmd=self.new(command, host, logger, stdin, timeout, ssh_opts)
|
|
220
221
|
cmd.run
|
|
221
222
|
cmd
|
|
222
223
|
end
|
|
223
224
|
|
|
224
225
|
# This one takes another parameter. +host+ is the machine
|
|
225
226
|
# where the command is going to be executed
|
|
226
|
-
def initialize(command, host, logger=nil, stdin=nil, timeout=nil)
|
|
227
|
+
def initialize(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
|
|
227
228
|
@host=host
|
|
229
|
+
@ssh_opts = ssh_opts
|
|
230
|
+
|
|
228
231
|
super(command, logger, stdin, timeout)
|
|
229
232
|
end
|
|
230
233
|
|
|
@@ -232,10 +235,10 @@ private
|
|
|
232
235
|
|
|
233
236
|
def execute
|
|
234
237
|
if @stdin
|
|
235
|
-
capture3_timeout("ssh #{@host} #{@command}",
|
|
238
|
+
capture3_timeout("ssh #{@ssh_opts} #{@host} #{@command}",
|
|
236
239
|
:pgroup => true, :stdin_data => @stdin)
|
|
237
240
|
else
|
|
238
|
-
capture3_timeout("ssh -n #{@host} #{@command}",
|
|
241
|
+
capture3_timeout("ssh -n #{@ssh_opts} #{@host} #{@command}",
|
|
239
242
|
:pgroup => true)
|
|
240
243
|
end
|
|
241
244
|
end
|
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 #
|
|
@@ -68,7 +68,9 @@ module DriverExecHelper
|
|
|
68
68
|
# @param [String, nil] default_name alternative name for the script
|
|
69
69
|
# @param [String, ''] directory to append to the scripts path for actions
|
|
70
70
|
# @return [String] command line needed to execute the action
|
|
71
|
-
def action_command_line(action, parameters,
|
|
71
|
+
def action_command_line(action, parameters,
|
|
72
|
+
default_name = nil, directory = '')
|
|
73
|
+
|
|
72
74
|
if action.is_a?(String) && action[0] == '/'
|
|
73
75
|
return action + ' ' + parameters if parameters
|
|
74
76
|
|
|
@@ -109,7 +111,9 @@ module DriverExecHelper
|
|
|
109
111
|
#
|
|
110
112
|
# Sends a message to the OpenNebula core through stdout
|
|
111
113
|
# rubocop:disable Metrics/ParameterLists
|
|
112
|
-
def send_message(action = '-', result = RESULT[:failure],
|
|
114
|
+
def send_message(action = '-', result = RESULT[:failure],
|
|
115
|
+
id = '-', info = '-')
|
|
116
|
+
|
|
113
117
|
@send_mutex.synchronize do
|
|
114
118
|
STDOUT.puts "#{action} #{result} #{id} #{info}"
|
|
115
119
|
STDOUT.flush
|
|
@@ -185,7 +189,7 @@ module DriverExecHelper
|
|
|
185
189
|
cfg=file.read
|
|
186
190
|
end
|
|
187
191
|
|
|
188
|
-
cfg.split(
|
|
192
|
+
cfg.split(/\n/).each do |line|
|
|
189
193
|
m=line.match(/^([^=]+)=(.*)$/)
|
|
190
194
|
|
|
191
195
|
next unless m
|
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 #
|
|
@@ -53,7 +53,9 @@ class VirtualMachineDriver < OpenNebulaDriver
|
|
|
53
53
|
:resize_disk => "RESIZEDISK",
|
|
54
54
|
:update_sg => "UPDATESG",
|
|
55
55
|
:update_conf => "UPDATECONF",
|
|
56
|
-
:resize => "RESIZE"
|
|
56
|
+
:resize => "RESIZE",
|
|
57
|
+
:backup => "BACKUP",
|
|
58
|
+
:update_nic => "UPDATENIC"
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
|
|
@@ -76,23 +78,23 @@ class VirtualMachineDriver < OpenNebulaDriver
|
|
|
76
78
|
|
|
77
79
|
super(directory, @options)
|
|
78
80
|
|
|
79
|
-
@hosts
|
|
80
|
-
|
|
81
|
-
register_action(ACTION[:deploy].to_sym,
|
|
82
|
-
register_action(ACTION[:shutdown].to_sym,
|
|
83
|
-
register_action(ACTION[:reboot].to_sym,
|
|
84
|
-
register_action(ACTION[:reset].to_sym,
|
|
85
|
-
register_action(ACTION[:cancel].to_sym,
|
|
86
|
-
register_action(ACTION[:save].to_sym,
|
|
87
|
-
register_action(ACTION[:restore].to_sym,
|
|
88
|
-
register_action(ACTION[:migrate].to_sym,
|
|
89
|
-
register_action(ACTION[:poll].to_sym,
|
|
81
|
+
@hosts = Array.new
|
|
82
|
+
|
|
83
|
+
register_action(ACTION[:deploy].to_sym, method("deploy"))
|
|
84
|
+
register_action(ACTION[:shutdown].to_sym, method("shutdown"))
|
|
85
|
+
register_action(ACTION[:reboot].to_sym, method("reboot"))
|
|
86
|
+
register_action(ACTION[:reset].to_sym, method("reset"))
|
|
87
|
+
register_action(ACTION[:cancel].to_sym, method("cancel"))
|
|
88
|
+
register_action(ACTION[:save].to_sym, method("save"))
|
|
89
|
+
register_action(ACTION[:restore].to_sym, method("restore"))
|
|
90
|
+
register_action(ACTION[:migrate].to_sym, method("migrate"))
|
|
91
|
+
register_action(ACTION[:poll].to_sym, method("poll"))
|
|
90
92
|
register_action(ACTION[:attach_disk].to_sym, method("attach_disk"))
|
|
91
93
|
register_action(ACTION[:detach_disk].to_sym, method("detach_disk"))
|
|
92
94
|
register_action(ACTION[:snapshot_create].to_sym, method("snapshot_create"))
|
|
93
95
|
register_action(ACTION[:snapshot_revert].to_sym, method("snapshot_revert"))
|
|
94
96
|
register_action(ACTION[:snapshot_delete].to_sym, method("snapshot_delete"))
|
|
95
|
-
register_action(ACTION[:cleanup].to_sym,
|
|
97
|
+
register_action(ACTION[:cleanup].to_sym, method("cleanup"))
|
|
96
98
|
register_action(ACTION[:attach_nic].to_sym, method("attach_nic"))
|
|
97
99
|
register_action(ACTION[:detach_nic].to_sym, method("detach_nic"))
|
|
98
100
|
register_action(ACTION[:disk_snapshot_create].to_sym, method("disk_snapshot_create"))
|
|
@@ -100,6 +102,8 @@ class VirtualMachineDriver < OpenNebulaDriver
|
|
|
100
102
|
register_action(ACTION[:update_sg].to_sym, method("update_sg"))
|
|
101
103
|
register_action(ACTION[:update_conf].to_sym, method("update_conf"))
|
|
102
104
|
register_action(ACTION[:resize].to_sym, method("resize"))
|
|
105
|
+
register_action(ACTION[:backup].to_sym, method("backup"))
|
|
106
|
+
register_action(ACTION[:update_nic].to_sym, method("update_nic"))
|
|
103
107
|
end
|
|
104
108
|
|
|
105
109
|
# Decodes the encoded XML driver message received from the core
|
|
@@ -234,6 +238,16 @@ class VirtualMachineDriver < OpenNebulaDriver
|
|
|
234
238
|
send_message(ACTION[:resize],RESULT[:failure],id,error)
|
|
235
239
|
end
|
|
236
240
|
|
|
241
|
+
def backup(id, drv_message)
|
|
242
|
+
error = "Action not implemented by driver #{self.class}"
|
|
243
|
+
send_message(ACTION[:backup],RESULT[:failure],id,error)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def update_nic(id, drv_message)
|
|
247
|
+
error = "Action not implemented by driver #{self.class}"
|
|
248
|
+
send_message(ACTION[:update_nic],RESULT[:failure],id,error)
|
|
249
|
+
end
|
|
250
|
+
|
|
237
251
|
private
|
|
238
252
|
|
|
239
253
|
# Interface to handle the pending events from the ActionManager Interface
|
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.5.80'
|
|
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 #
|
|
@@ -929,26 +929,30 @@ module VCenterDriver
|
|
|
929
929
|
spec.configSpec.maxMtu = mtu
|
|
930
930
|
|
|
931
931
|
# The DVS must be created in the networkFolder of the datacenter
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
932
|
+
begin
|
|
933
|
+
dvs_creation_task = @item
|
|
934
|
+
.networkFolder
|
|
935
|
+
.CreateDVS_Task(
|
|
936
|
+
:spec => spec
|
|
937
|
+
)
|
|
938
|
+
dvs_creation_task.wait_for_completion
|
|
939
|
+
|
|
940
|
+
# If task finished successfuly we rename the uplink portgroup
|
|
941
|
+
dvs = nil
|
|
942
|
+
if dvs_creation_task.info.state == 'success'
|
|
943
|
+
dvs = dvs_creation_task.info.result
|
|
944
|
+
dvs
|
|
945
|
+
.config
|
|
946
|
+
.uplinkPortgroup[0]
|
|
947
|
+
.Rename_Task(
|
|
948
|
+
:newName => "#{switch_name}-uplink-pg"
|
|
949
|
+
).wait_for_completion
|
|
950
|
+
else
|
|
951
|
+
raise "The Distributed vSwitch #{switch_name} \
|
|
952
|
+
could not be created. "
|
|
953
|
+
end
|
|
954
|
+
rescue StandardError => e
|
|
955
|
+
raise e
|
|
952
956
|
end
|
|
953
957
|
|
|
954
958
|
@net_rollback << {
|
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 #
|
|
@@ -743,9 +743,9 @@ module VCenterDriver
|
|
|
743
743
|
image_path = ''
|
|
744
744
|
|
|
745
745
|
# Skip not relevant files
|
|
746
|
-
next unless [
|
|
747
|
-
|
|
748
|
-
|
|
746
|
+
next unless %w[FloppyImageFileInfo
|
|
747
|
+
IsoImageFileInfo
|
|
748
|
+
VmDiskFileInfo].include? image.class.to_s
|
|
749
749
|
|
|
750
750
|
# Get image path and name
|
|
751
751
|
image_path << folderpath << image.path
|
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 #
|
|
@@ -109,7 +109,7 @@ module VCenterDriver
|
|
|
109
109
|
def self.needs_unpack?(file_path)
|
|
110
110
|
type = get_type(file_path)
|
|
111
111
|
type.gsub!(%r{^application/(x-)?}, '')
|
|
112
|
-
[
|
|
112
|
+
%w[bzip2 gzip tar].include?(type)
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
def self.vcenter_file_info(file_path)
|
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 #
|
|
@@ -233,7 +233,7 @@ module VCenterDriver
|
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
nxs_type = @one_item['TEMPLATE/NSX_TYPE']
|
|
236
|
-
|
|
236
|
+
unless nxs_type == NSXDriver::NSXConstants::NSXT; return; end
|
|
237
237
|
|
|
238
238
|
# URL to test a connection
|
|
239
239
|
url = '/api/v1/transport-zones'
|
|
@@ -352,7 +352,7 @@ module VCenterDriver
|
|
|
352
352
|
str_info << 'USEDMEMORY=' << (total_mem - free_mem).to_s << "\n"
|
|
353
353
|
|
|
354
354
|
# DRS enabled
|
|
355
|
-
str_info << 'VCENTER_DRS='
|
|
355
|
+
str_info << 'VCENTER_DRS=' << drs_enabled.to_s << "\n"
|
|
356
356
|
|
|
357
357
|
# HA enabled
|
|
358
358
|
str_info << 'VCENTER_HA=' << ha_enabled.to_s << "\n"
|
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 #
|
|
@@ -32,26 +32,26 @@ module OpenNebula
|
|
|
32
32
|
attr_reader :service
|
|
33
33
|
|
|
34
34
|
# Actions that can be performed on the VMs of a given Role
|
|
35
|
-
SCHEDULE_ACTIONS = [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
SCHEDULE_ACTIONS = %w[
|
|
36
|
+
terminate
|
|
37
|
+
terminate-hard
|
|
38
|
+
undeploy
|
|
39
|
+
undeploy-hard
|
|
40
|
+
hold
|
|
41
|
+
release
|
|
42
|
+
stop
|
|
43
|
+
suspend
|
|
44
|
+
resume
|
|
45
|
+
reboot
|
|
46
|
+
reboot-hard
|
|
47
|
+
poweroff
|
|
48
|
+
poweroff-hard
|
|
49
|
+
snapshot-create
|
|
50
|
+
snapshot-revert
|
|
51
|
+
snapshot-delete
|
|
52
|
+
disk-snapshot-create
|
|
53
|
+
disk-snapshot-revert
|
|
54
|
+
disk-snapshot-delete
|
|
55
55
|
]
|
|
56
56
|
|
|
57
57
|
STATE = {
|
|
@@ -69,52 +69,52 @@ module OpenNebula
|
|
|
69
69
|
'HOLD' => 11
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
STATE_STR = [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
STATE_STR = %w[
|
|
73
|
+
PENDING
|
|
74
|
+
DEPLOYING
|
|
75
|
+
RUNNING
|
|
76
|
+
UNDEPLOYING
|
|
77
|
+
WARNING
|
|
78
|
+
DONE
|
|
79
|
+
FAILED_UNDEPLOYING
|
|
80
|
+
FAILED_DEPLOYING
|
|
81
|
+
SCALING
|
|
82
|
+
FAILED_SCALING
|
|
83
|
+
COOLDOWN
|
|
84
|
+
HOLD
|
|
85
85
|
]
|
|
86
86
|
|
|
87
|
-
RECOVER_DEPLOY_STATES = [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
RECOVER_DEPLOY_STATES = %w[
|
|
88
|
+
FAILED_DEPLOYING
|
|
89
|
+
DEPLOYING
|
|
90
|
+
PENDING
|
|
91
91
|
]
|
|
92
92
|
|
|
93
|
-
RECOVER_UNDEPLOY_STATES = [
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
RECOVER_UNDEPLOY_STATES = %w[
|
|
94
|
+
FAILED_UNDEPLOYING
|
|
95
|
+
UNDEPLOYING
|
|
96
96
|
]
|
|
97
97
|
|
|
98
|
-
RECOVER_SCALE_STATES = [
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
RECOVER_SCALE_STATES = %w[
|
|
99
|
+
FAILED_SCALING
|
|
100
|
+
SCALING
|
|
101
101
|
]
|
|
102
102
|
|
|
103
|
-
VM_FAILURE_STATES = [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
VM_FAILURE_STATES = %w[
|
|
104
|
+
BOOT_FAILURE
|
|
105
|
+
BOOT_MIGRATE_FAILURE
|
|
106
|
+
PROLOG_MIGRATE_FAILURE
|
|
107
|
+
PROLOG_FAILURE
|
|
108
|
+
EPILOG_FAILURE
|
|
109
|
+
EPILOG_STOP_FAILURE
|
|
110
|
+
EPILOG_UNDEPLOY_FAILURE
|
|
111
|
+
PROLOG_MIGRATE_POWEROFF_FAILURE
|
|
112
|
+
PROLOG_MIGRATE_SUSPEND_FAILURE
|
|
113
|
+
PROLOG_MIGRATE_UNKNOWN_FAILURE
|
|
114
|
+
BOOT_UNDEPLOY_FAILURE
|
|
115
|
+
BOOT_STOPPED_FAILURE
|
|
116
|
+
PROLOG_RESUME_FAILURE
|
|
117
|
+
PROLOG_UNDEPLOY_FAILURE
|
|
118
118
|
]
|
|
119
119
|
|
|
120
120
|
SCALE_WAYS = {
|
|
@@ -129,17 +129,17 @@ module OpenNebula
|
|
|
129
129
|
# parents: this has only sense in deploy operation
|
|
130
130
|
# state: this is internal information managed by OneFlow server
|
|
131
131
|
# vm_template: this will affect scale operation
|
|
132
|
-
IMMUTABLE_ATTRS = [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
IMMUTABLE_ATTRS = %w[
|
|
133
|
+
cardinality
|
|
134
|
+
last_vmname
|
|
135
|
+
nodes
|
|
136
|
+
parents
|
|
137
|
+
state
|
|
138
|
+
vm_template
|
|
139
139
|
]
|
|
140
140
|
|
|
141
141
|
# VM information to save in document
|
|
142
|
-
VM_INFO = [
|
|
142
|
+
VM_INFO = %w[ID UID GID UNAME GNAME NAME]
|
|
143
143
|
|
|
144
144
|
LOG_COMP = 'ROL'
|
|
145
145
|
|
|
@@ -455,6 +455,9 @@ module OpenNebula
|
|
|
455
455
|
extra_template << "\nSERVICE_ID = #{@service.id}"
|
|
456
456
|
extra_template << "\nROLE_NAME = \"#{@body['name']}\""
|
|
457
457
|
|
|
458
|
+
# Evaluate attributes with parent roles
|
|
459
|
+
evaluate(extra_template)
|
|
460
|
+
|
|
458
461
|
n_nodes.times do
|
|
459
462
|
vm_name = @@vm_name_template
|
|
460
463
|
.gsub('$SERVICE_ID', @service.id.to_s)
|
|
@@ -634,8 +637,8 @@ module OpenNebula
|
|
|
634
637
|
return OpenNebula::Error.new("Role #{name} is in DONE state")
|
|
635
638
|
end
|
|
636
639
|
|
|
637
|
-
do_offset = !period.nil? && period.to_i > 0 &&
|
|
638
|
-
|
|
640
|
+
do_offset = (!period.nil? && period.to_i > 0 &&
|
|
641
|
+
!vms_per_period.nil? && vms_per_period.to_i > 0)
|
|
639
642
|
|
|
640
643
|
nodes.each_with_index do |node, index|
|
|
641
644
|
vm_id = node['deploy_id']
|
|
@@ -1122,7 +1125,7 @@ module OpenNebula
|
|
|
1122
1125
|
# Min is a hard limit, if the current cardinality + adjustment does
|
|
1123
1126
|
# not reach it, the difference is added
|
|
1124
1127
|
|
|
1125
|
-
max = [cardinality, max_cardinality.to_i].max
|
|
1128
|
+
max = [cardinality, max_cardinality.to_i].max()
|
|
1126
1129
|
# min = [cardinality(), min_cardinality.to_i].min()
|
|
1127
1130
|
min = min_cardinality.to_i
|
|
1128
1131
|
|
|
@@ -1168,6 +1171,49 @@ module OpenNebula
|
|
|
1168
1171
|
new_cardinality
|
|
1169
1172
|
end
|
|
1170
1173
|
|
|
1174
|
+
# Evaluate rules that references to parent roles
|
|
1175
|
+
#
|
|
1176
|
+
# @param template [String] Role template with $ to replace
|
|
1177
|
+
def evaluate(template)
|
|
1178
|
+
client = service.client
|
|
1179
|
+
|
|
1180
|
+
template.scan(/\$\{(.*?)\}/).flatten.each do |value|
|
|
1181
|
+
s_value = value.split('.') # 0 -> parent, 1..N -> XPATH
|
|
1182
|
+
|
|
1183
|
+
# If parent not found, instead of error, replace it by blank
|
|
1184
|
+
unless parents.include?(s_value[0])
|
|
1185
|
+
template.gsub!("${#{value}}", '')
|
|
1186
|
+
next
|
|
1187
|
+
end
|
|
1188
|
+
|
|
1189
|
+
found = false
|
|
1190
|
+
p_nodes = service.roles[s_value[0]].nodes
|
|
1191
|
+
xpath = "//#{s_value[1..-1].join('/').upcase}"
|
|
1192
|
+
|
|
1193
|
+
# Iterate over parent nodes to find the XPATH on their template
|
|
1194
|
+
p_nodes.each do |node|
|
|
1195
|
+
id = node['deploy_id']
|
|
1196
|
+
vm = OpenNebula::VirtualMachine.new_with_id(id, client)
|
|
1197
|
+
|
|
1198
|
+
# If error continue searching in other nodes
|
|
1199
|
+
next if OpenNebula.is_error?(vm.info)
|
|
1200
|
+
|
|
1201
|
+
next unless vm[xpath]
|
|
1202
|
+
|
|
1203
|
+
template.gsub!("${#{value}}", vm[xpath])
|
|
1204
|
+
|
|
1205
|
+
# If found, continue with next expression
|
|
1206
|
+
found = true
|
|
1207
|
+
break
|
|
1208
|
+
end
|
|
1209
|
+
|
|
1210
|
+
next if found
|
|
1211
|
+
|
|
1212
|
+
# If value not found, replace it by blank to avoid issues
|
|
1213
|
+
template.gsub!("${#{value}}", '')
|
|
1214
|
+
end
|
|
1215
|
+
end
|
|
1216
|
+
|
|
1171
1217
|
end
|
|
1172
1218
|
|
|
1173
1219
|
end
|