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,176 +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
-
17
- require 'shellwords'
18
-
19
- module OpenNebula
20
-
21
- # Generic log function
22
- def self.log_function(severity, message)
23
- STDERR.puts "#{severity}: #{File.basename $0}: #{message}"
24
- end
25
-
26
- # Logs an info message
27
- def self.log_info(message)
28
- log_function("INFO", message)
29
- end
30
-
31
- # Logs an info message
32
- def self.log_warning(message)
33
- log_function('WARNING', message)
34
- end
35
-
36
- # Logs an error message
37
- def self.log_error(message)
38
- log_function("ERROR", message)
39
- end
40
-
41
- # Logs a debug message
42
- def self.log_debug(message)
43
- log_function("DEBUG", message)
44
- end
45
-
46
- # Alias log to log_info in the singleton class
47
- class << self
48
- alias :log :log_info
49
- end
50
-
51
- # This function is used to pass error message to the mad
52
- def self.error_message(message)
53
- STDERR.puts message
54
- end
55
-
56
- def self.is_disk?(arg)
57
- arg.match("disk\.[0-9]+$")
58
- end
59
-
60
- # Gets the host from an argument
61
- def self.arg_host(arg)
62
- result = arg.match("^\([^:]*\):.*$")
63
-
64
- return result[1] if result
65
- end
66
-
67
- def self.arg_path(arg)
68
- result = arg.match('^[^:]*:(.*)$')
69
-
70
- return result[1] if result
71
- end
72
-
73
- # Executes a command, if it fails returns error message and exits
74
- # If a second parameter is present it is used as the error message when
75
- # the command fails
76
- def self.exec_and_log(command, message=nil, allowed_return_code=0)
77
- command = command.shellsplit.shelljoin # escape
78
- output=`#{command} 2>&1 1>/dev/null`
79
- code=$?.exitstatus
80
-
81
- if code!=0 && code!=allowed_return_code
82
- log_error "Command \"#{command}\" failed."
83
- log_error output
84
- if !message
85
- error_message output
86
- else
87
- error_message message
88
- end
89
- exit code
90
- end
91
- log "Executed \"#{command}\"."
92
- end
93
-
94
- def self.send_to_monitor(msg_type, result, oid, data)
95
- # Read monitord.conf
96
- one_location = ENV['ONE_LOCATION']
97
-
98
- if !one_location
99
- file_dir = '/etc/one/'
100
- else
101
- file_dir = one_location + '/etc/'
102
- end
103
-
104
- file_name = 'monitord.conf'
105
-
106
- begin
107
- require 'augeas'
108
-
109
- aug = Augeas.create(:no_modl_autoload => true,
110
- :no_load => true,
111
- :root => file_dir,
112
- :loadpath => file_name)
113
-
114
- aug.clear_transforms
115
- aug.transform(:lens => 'Oned.lns', :incl => file_name)
116
- aug.context = "/files/#{file_name}"
117
- aug.load
118
-
119
- mon_address = aug.get('NETWORK/MONITOR_ADDRESS')
120
- mon_port = aug.get('NETWORK/PORT')
121
- mon_key = aug.get('NETWORK/PUBKEY').tr('"', '')
122
-
123
- mon_address = "127.0.0.1" if mon_address.include? "auto"
124
- rescue LoadError
125
- mon_address = "127.0.0.1"
126
- mon_port = 4124
127
- end
128
-
129
- # Encrypt
130
- if mon_key && !mon_key.empty?
131
- block_size = mon_key.n.num_bytes - 11
132
-
133
- edata = ''
134
- index = 0
135
-
136
- loop do
137
- break if index >= data.length
138
-
139
- edata << mon_key.public_encrypt(data[index, block_size])
140
-
141
- index += block_size
142
- end
143
-
144
- data = edata
145
- end
146
-
147
- # Send data
148
- begin
149
- require 'base64'
150
- require 'zlib'
151
- require 'socket'
152
-
153
- zdata = Zlib::Deflate.deflate(data, Zlib::BEST_COMPRESSION)
154
- data64 = Base64.strict_encode64(zdata)
155
-
156
- if (result == "SUCCESS" || result == "0")
157
- result = "SUCCESS"
158
- else
159
- result = "FAILURE"
160
- end
161
-
162
- if Integer(oid) == -1
163
- ts = 0
164
- else
165
- ts = Time.now.to_i
166
- end
167
-
168
- msg = "#{msg_type} #{result} #{oid} #{ts} #{data64}"
169
-
170
- socket_udp = UDPSocket.new()
171
- socket_udp.send(msg, 0, mon_address, mon_port)
172
- rescue LoadError
173
- STDERR.puts('Unable to send data to Monitor Daemon')
174
- end
175
- end
176
- end
@@ -1,43 +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
- module NSXDriver
17
-
18
- # Class Transport Zone
19
- class TransportZone < NSXComponent
20
-
21
- # ATTRIBUTES
22
- attr_reader :tz_id
23
-
24
- def self.new_child(nsx_client)
25
- case nsx_client.nsx_type.upcase
26
- when NSXConstants::NSXT
27
- NSXTtz.new(nsx_client)
28
- when NSXConstants::NSXV
29
- NSXVtz.new(nsx_client)
30
- else
31
- error_msg = "Unknown NSX type: #{nsx_client.nsx_type}"
32
- error = NSXError::UnknownObject.new(error_msg)
33
- raise error
34
- end
35
- end
36
-
37
- # METHODS
38
- # Return the transport zones list
39
- def tzs; end
40
-
41
- end
42
-
43
- end
@@ -1,152 +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
-
17
- # ---------------------------------------------------------------------------- #
18
- # Set up the environment for the driver #
19
- # ---------------------------------------------------------------------------- #
20
-
21
- ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION)
22
-
23
- if !ONE_LOCATION
24
- BIN_LOCATION = '/usr/bin' unless defined?(BIN_LOCATION)
25
- LIB_LOCATION = '/usr/lib/one' unless defined?(LIB_LOCATION)
26
- ETC_LOCATION = '/etc/one/' unless defined?(ETC_LOCATION)
27
- VAR_LOCATION = '/var/lib/one' unless defined?(VAR_LOCATION)
28
- GEMS_LOCATION = '/usr/share/one/gems' unless defined?(GEMS_LOCATION)
29
- else
30
- BIN_LOCATION = ONE_LOCATION + '/bin' unless defined?(BIN_LOCATION)
31
- LIB_LOCATION = ONE_LOCATION + '/lib' unless defined?(LIB_LOCATION)
32
- ETC_LOCATION = ONE_LOCATION + '/etc/' unless defined?(ETC_LOCATION)
33
- VAR_LOCATION = ONE_LOCATION + '/var/' unless defined?(VAR_LOCATION)
34
- GEMS_LOCATION = ONE_LOCATION + '/share/gems' unless defined?(GEMS_LOCATION)
35
- end
36
-
37
- ENV['LANG'] = 'C'
38
-
39
- # %%RUBYGEMS_SETUP_BEGIN%%
40
- if File.directory?(GEMS_LOCATION)
41
- real_gems_path = File.realpath(GEMS_LOCATION)
42
- if !defined?(Gem) || Gem.path != [real_gems_path]
43
- $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
44
-
45
- # Suppress warnings from Rubygems
46
- # https://github.com/OpenNebula/one/issues/5379
47
- begin
48
- verb = $VERBOSE
49
- $VERBOSE = nil
50
- require 'rubygems'
51
- Gem.use_paths(real_gems_path)
52
- ensure
53
- $VERBOSE = verb
54
- end
55
- end
56
- end
57
- # %%RUBYGEMS_SETUP_END%%
58
-
59
- $LOAD_PATH << LIB_LOCATION + '/ruby/vendors/rbvmomi/lib'
60
- $LOAD_PATH << LIB_LOCATION + '/ruby'
61
- $LOAD_PATH << LIB_LOCATION + '/ruby/vcenter_driver'
62
-
63
- # Holds vCenter configuration parameters
64
- class VCenterConf < Hash
65
-
66
- DEFAULT_CONFIGURATION = {
67
- :delete_images => false,
68
- :vm_poweron_wait_default => 300,
69
- :debug_information => false,
70
- :retries => 3,
71
- :retry_interval => 1
72
- }
73
-
74
- def initialize
75
- replace(DEFAULT_CONFIGURATION)
76
- begin
77
- vcenterrc_path = "#{VAR_LOCATION}/remotes/etc/vmm/vcenter/vcenterrc"
78
- merge!(YAML.load_file(vcenterrc_path))
79
- rescue StandardError => e
80
- STDERR.puts "Couldn't load vcenterrc. Reason #{e.message}."
81
- end
82
-
83
- super
84
- end
85
-
86
- end
87
-
88
- require 'rbvmomi'
89
- require 'yaml'
90
- require 'opennebula'
91
- require 'base64'
92
- require 'openssl'
93
- require 'digest'
94
- require 'resolv'
95
-
96
- # ---------------------------------------------------------------------------- #
97
- # vCenter Library #
98
- # ---------------------------------------------------------------------------- #
99
-
100
- require 'vcenter_importer'
101
- require 'memoize'
102
- require 'vi_client'
103
- begin
104
- require 'rest_client'
105
- REST_CLIENT=true
106
- rescue LoadError
107
- REST_CLIENT=false
108
- end
109
- require 'vi_helper'
110
- require 'datacenter'
111
- require 'host'
112
- require 'datastore'
113
- require 'vm_template'
114
- require 'virtual_machine'
115
- require 'network'
116
- require 'file_helper'
117
- require 'vm_folder'
118
- require 'vmm_importer'
119
- require 'vm_device'
120
- require 'vm_disk'
121
- require 'vm_nic'
122
- require 'vm_helper'
123
-
124
- CHECK_REFS = true
125
-
126
- module VCenterDriver
127
-
128
- CONFIG = VCenterConf.new
129
-
130
- end
131
-
132
- # ---------------------------------------------------------------------------- #
133
- # Helper functions #
134
- # ---------------------------------------------------------------------------- #
135
-
136
- def check_valid(parameter, label)
137
- return unless parameter.nil? || parameter.empty?
138
-
139
- STDERR.puts "The parameter '#{label}' is required for this action."
140
- exit(-1)
141
- end
142
-
143
- def check_item(item, target_class)
144
- item.name if CHECK_REFS
145
- if target_class && !item.instance_of?(target_class)
146
- raise "Expecting type 'RbVmomi::VIM::#{target_class}'. " \
147
- "Got '#{item.class} instead."
148
- end
149
- rescue RbVmomi::Fault => e
150
- raise "Reference \"#{item._ref}\" error [#{e.message}]. \
151
- The reference does not exist"
152
- end