opennebula 5.10.4 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +13 -3
  4. data/lib/DriverExecHelper.rb +19 -18
  5. data/lib/OpenNebulaDriver.rb +38 -62
  6. data/lib/VirtualMachineDriver.rb +1 -1
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/opennebula.rb +2 -2
  9. data/lib/opennebula/acl.rb +1 -1
  10. data/lib/opennebula/acl_pool.rb +1 -1
  11. data/lib/opennebula/client.rb +1 -1
  12. data/lib/opennebula/cluster.rb +1 -1
  13. data/lib/opennebula/cluster_pool.rb +1 -1
  14. data/lib/opennebula/datastore.rb +1 -1
  15. data/lib/opennebula/datastore_pool.rb +1 -1
  16. data/lib/opennebula/document.rb +1 -1
  17. data/lib/opennebula/document_json.rb +1 -1
  18. data/lib/opennebula/document_pool.rb +2 -2
  19. data/lib/opennebula/document_pool_json.rb +1 -1
  20. data/lib/opennebula/error.rb +1 -1
  21. data/lib/opennebula/group.rb +1 -1
  22. data/lib/opennebula/group_pool.rb +1 -1
  23. data/lib/opennebula/hook.rb +1 -1
  24. data/lib/opennebula/hook_log.rb +1 -1
  25. data/lib/opennebula/hook_pool.rb +1 -1
  26. data/lib/opennebula/host.rb +13 -5
  27. data/lib/opennebula/host_pool.rb +11 -5
  28. data/lib/opennebula/image.rb +1 -1
  29. data/lib/opennebula/image_pool.rb +1 -1
  30. data/lib/opennebula/ldap_auth.rb +24 -19
  31. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  32. data/lib/opennebula/marketplace.rb +1 -1
  33. data/lib/opennebula/marketplace_pool.rb +1 -1
  34. data/lib/opennebula/marketplaceapp.rb +4 -3
  35. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  36. data/lib/opennebula/oneflow_client.rb +24 -3
  37. data/lib/opennebula/pool.rb +4 -10
  38. data/lib/opennebula/pool_element.rb +9 -37
  39. data/lib/opennebula/security_group.rb +1 -1
  40. data/lib/opennebula/security_group_pool.rb +1 -1
  41. data/lib/opennebula/server_cipher_auth.rb +1 -1
  42. data/lib/opennebula/server_x509_auth.rb +1 -1
  43. data/lib/opennebula/ssh_auth.rb +1 -1
  44. data/lib/opennebula/system.rb +3 -3
  45. data/lib/opennebula/template.rb +1 -1
  46. data/lib/opennebula/template_pool.rb +1 -1
  47. data/lib/opennebula/user.rb +1 -1
  48. data/lib/opennebula/user_pool.rb +1 -1
  49. data/lib/opennebula/utils.rb +1 -1
  50. data/lib/opennebula/vdc.rb +1 -1
  51. data/lib/opennebula/vdc_pool.rb +1 -1
  52. data/lib/opennebula/virtual_machine.rb +10 -7
  53. data/lib/opennebula/virtual_machine_pool.rb +9 -7
  54. data/lib/opennebula/virtual_network.rb +9 -3
  55. data/lib/opennebula/virtual_network_pool.rb +1 -1
  56. data/lib/opennebula/virtual_router.rb +1 -1
  57. data/lib/opennebula/virtual_router_pool.rb +1 -1
  58. data/lib/opennebula/vm_group.rb +1 -1
  59. data/lib/opennebula/vm_group_pool.rb +1 -1
  60. data/lib/opennebula/vntemplate.rb +1 -1
  61. data/lib/opennebula/vntemplate_pool.rb +1 -1
  62. data/lib/opennebula/x509_auth.rb +1 -1
  63. data/lib/opennebula/xml_element.rb +1 -1
  64. data/lib/opennebula/xml_pool.rb +1 -1
  65. data/lib/opennebula/xml_utils.rb +1 -1
  66. data/lib/opennebula/zone.rb +1 -1
  67. data/lib/opennebula/zone_pool.rb +1 -1
  68. data/lib/vcenter_driver.rb +8 -2
  69. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b72dc0acda9502bdef71dd4c9001dcd2e6b75131
4
- data.tar.gz: 508951629d02e835c5a1f8cb73357f856c24953a
3
+ metadata.gz: 56a4d4714f58633bd2aa93a39a0a0bf794782d64
4
+ data.tar.gz: baf93114e6465fbca2a66a71d458638d9ff54061
5
5
  SHA512:
6
- metadata.gz: 706b2b574f255ab8b618e73ba8be9abf6b22bda6c25b7f24fe498db6fda87dff53ea08fce723e7db2f4166cf16f961b44642e77cc4cf9c2fb1420881b4181029
7
- data.tar.gz: 6ff3bf7050b548a4f197b565707745f534462c006898efde522d226310d92d1001b70e415c3b2899cbce7f3ce1d84b1a514791429ae6bf6d0968a825c0505f0b
6
+ metadata.gz: cd7c9416854f0a4b6b9d9148ffe800dbee1f39706737aebc8c8692eb36041352704fca815aac338a1886478756fbaec08cc812f1511c3f7b3780de7b9a59be9e
7
+ data.tar.gz: 3d12e853e46eac65b0f2023bb38158db72f9beedd704e842b31f9e0b19d96713a2e654146a6b37db4db8f3abae55e919437606343ef22280da977cc3bba48843
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- */
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 */
@@ -1,5 +1,5 @@
1
1
  # --------------------------------------------------------------------------
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems
2
+ # Copyright 2002-2020, 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
@@ -179,13 +179,23 @@ private
179
179
  i.write stdin_data
180
180
  i.close
181
181
 
182
- out = [out_reader.value, err_reader.value, t.value]
182
+ # blocking wait for process termination
183
+ t.value
184
+
185
+ # if reader threads are not dead yet, kill them
186
+ [out_reader, err_reader].each do |reader|
187
+ next unless reader.status
188
+
189
+ reader.join(0.1)
190
+ reader.kill
191
+ end
183
192
 
184
193
  mutex.lock
185
194
  terminator.kill
186
195
  raise terminator_e if terminator_e
187
196
 
188
- out
197
+ # return values
198
+ [out_reader.value, err_reader.value, t.value]
189
199
  }
190
200
  end
191
201
 
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -28,15 +28,15 @@ module DriverExecHelper
28
28
  return rc_str == RESULT[:failure]
29
29
  end
30
30
 
31
- #Initialize module variables
31
+ # Initialize module variables
32
32
  def initialize_helper(directory, options)
33
33
  @config = read_configuration
34
34
  @remote_scripts_base_path = @config['SCRIPTS_REMOTE_DIR']
35
35
 
36
36
  @local_actions = options[:local_actions]
37
37
 
38
- if ENV['ONE_LOCATION'] == nil
39
- @local_scripts_base_path = "/var/lib/one/remotes"
38
+ if ENV['ONE_LOCATION'].nil?
39
+ @local_scripts_base_path = '/var/lib/one/remotes'
40
40
  else
41
41
  @local_scripts_base_path = "#{ENV['ONE_LOCATION']}/var/remotes"
42
42
  end
@@ -176,37 +176,38 @@ module DriverExecHelper
176
176
  one_config = '/var/lib/one/config'
177
177
  end
178
178
 
179
- config=Hash.new
180
- cfg=''
179
+ config = {}
180
+ cfg = ''
181
181
 
182
182
  begin
183
- open(one_config) do |file|
183
+ File.open(one_config, 'r') do |file|
184
184
  cfg=file.read
185
185
  end
186
186
 
187
187
  cfg.split(/\n/).each do |line|
188
188
  m=line.match(/^([^=]+)=(.*)$/)
189
189
 
190
- if m
191
- name=m[1].strip.upcase
192
- value=m[2].strip
190
+ next unless m
193
191
 
194
- if config[name]
195
- if config[name].instance_of? Array
196
- config[name] << value
197
- else
198
- config[name] = [config[name], value]
199
- end
192
+ name = m[1].strip.upcase
193
+ value = m[2].strip
194
+
195
+ if config[name]
196
+ if config[name].instance_of? Array
197
+ config[name] << value
200
198
  else
201
- config[name]=value
199
+ config[name] = [config[name], value]
202
200
  end
201
+ else
202
+ config[name]=value
203
203
  end
204
204
  end
205
- rescue Exception => e
205
+ rescue StandardException => e
206
206
  STDERR.puts "Error reading config: #{e.inspect}"
207
207
  STDERR.flush
208
208
  end
209
209
 
210
210
  config
211
211
  end
212
+
212
213
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -14,10 +14,10 @@
14
14
  # limitations under the License. #
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
- require "ActionManager"
18
- require "CommandManager"
17
+ require 'ActionManager'
18
+ require 'CommandManager'
19
19
 
20
- require "DriverExecHelper"
20
+ require 'DriverExecHelper'
21
21
  require 'base64'
22
22
 
23
23
  # This class provides basic messaging and logging functionality
@@ -29,6 +29,7 @@ require 'base64'
29
29
  # for each action it wants to receive. The method must be associated
30
30
  # with the action name through the register_action function
31
31
  class OpenNebulaDriver < ActionManager
32
+
32
33
  include DriverExecHelper
33
34
 
34
35
  # @return [String] Base path for scripts
@@ -48,13 +49,13 @@ class OpenNebulaDriver < ActionManager
48
49
  # @option options [Hash] :local_actions ({}) hash with the actions
49
50
  # executed locally and the name of the script if it differs from the
50
51
  # default one. This hash can be constructed using {parse_actions_list}
51
- def initialize(directory, options={})
52
+ def initialize(directory, options = {})
52
53
  @options={
53
54
  :concurrency => 10,
54
- :threaded => true,
55
- :retries => 0,
55
+ :threaded => true,
56
+ :retries => 0,
56
57
  :local_actions => {},
57
- :timeout => nil
58
+ :timeout => nil
58
59
  }.merge!(options)
59
60
 
60
61
  super(@options[:concurrency], @options[:threaded])
@@ -62,14 +63,12 @@ class OpenNebulaDriver < ActionManager
62
63
  @retries = @options[:retries]
63
64
  @timeout = @options[:timeout]
64
65
 
65
- #Set default values
66
+ # Set default values
66
67
  initialize_helper(directory, @options)
67
68
 
68
- register_action(:INIT, method("init"))
69
+ register_action(:INIT, method('init'))
69
70
  end
70
71
 
71
-
72
-
73
72
  # Calls remotes or local action checking the action name and
74
73
  # @local_actions. Optional arguments can be specified as a hash
75
74
  #
@@ -83,20 +82,22 @@ class OpenNebulaDriver < ActionManager
83
82
  # action name is used by defaults
84
83
  # @option ops [Bool] :respond if defined will send result to ONE core
85
84
  # @option ops [Bool] :base64 encode the information sent to ONE core
86
- def do_action(parameters, id, host, aname, ops={})
87
- options={
88
- :stdin => nil,
85
+ # @option ops [Bool] :zip compress the information sent to ONE core
86
+ def do_action(parameters, id, host, aname, ops = {})
87
+ options = {
88
+ :stdin => nil,
89
89
  :script_name => nil,
90
- :respond => true,
91
- :ssh_stream => nil,
92
- :base64 => false
90
+ :respond => true,
91
+ :ssh_stream => nil,
92
+ :base64 => false,
93
+ :zip => false
93
94
  }.merge(ops)
94
95
 
95
96
  params = parameters + " #{id} #{host}"
96
97
  command = action_command_line(aname, params, options[:script_name])
97
98
 
98
99
  if action_is_local?(aname)
99
- stdin = Base64::encode64(options[:stdin].to_s.gsub("\n",""))
100
+ stdin = Base64.strict_encode64(options[:stdin].to_s)
100
101
  execution = LocalCommand.run(command,
101
102
  log_method(id),
102
103
  stdin,
@@ -114,7 +115,6 @@ class OpenNebulaDriver < ActionManager
114
115
  stdin,
115
116
  command,
116
117
  @timeout)
117
-
118
118
  else
119
119
  execution = RemotesCommand.run(command,
120
120
  host,
@@ -128,20 +128,20 @@ class OpenNebulaDriver < ActionManager
128
128
  result, info = get_info_from_execution(execution)
129
129
 
130
130
  if options[:respond]
131
- info = Base64::encode64(info).strip.delete("\n") if options[:base64]
131
+ info = Zlib::Deflate.deflate(info, Zlib::BEST_COMPRESSION) if options[:zip]
132
+ info = Base64.strict_encode64(info) if options[:base64]
133
+
132
134
  send_message(aname, result, id, info)
133
135
  end
134
136
 
135
137
  [result, info]
136
138
  end
137
139
 
138
-
139
140
  # Start the driver. Reads from STDIN and executes methods associated with
140
141
  # the messages
141
142
  def start_driver
142
- loop_thread = Thread.new { loop }
143
+ Thread.new { loop }
143
144
  start_listener
144
- loop_thread.kill
145
145
  end
146
146
 
147
147
  # This function parses a string with this form:
@@ -156,12 +156,12 @@ class OpenNebulaDriver < ActionManager
156
156
  # @param [String] str imput string to parse
157
157
  # @return [Hash] parsed actions
158
158
  def self.parse_actions_list(str)
159
- actions=Hash.new
160
- str_splitted=str.split(/\s*,\s*/).map {|s| s.strip }
159
+ actions = {}
160
+ str_splitted = str.split(/\s*,\s*/).map {|s| s.strip }
161
161
 
162
162
  str_splitted.each do |a|
163
163
  m=a.match(/([^=]+)(=(.*))?/)
164
- next if !m
164
+ next unless m
165
165
 
166
166
  action=m[1].upcase
167
167
 
@@ -178,21 +178,21 @@ class OpenNebulaDriver < ActionManager
178
178
  actions
179
179
  end
180
180
 
181
- private
181
+ private
182
182
 
183
183
  def init
184
- send_message("INIT",RESULT[:success])
184
+ send_message('INIT', RESULT[:success])
185
185
  end
186
186
 
187
187
  def loop
188
- while true
189
- exit(-1) if STDIN.eof?
188
+ Kernel.loop do
189
+ exit!(-1) if STDIN.eof?
190
190
 
191
- str=STDIN.gets
192
- next if !str
191
+ str = STDIN.gets
192
+ next unless str
193
193
 
194
- args = str.split(/\s+/)
195
- next if args.length == 0
194
+ args = str.split(/\s+/)
195
+ next if args.empty?
196
196
 
197
197
  if args.first.empty?
198
198
  STDERR.puts "Malformed message: #{str.inspect}"
@@ -201,7 +201,7 @@ private
201
201
 
202
202
  action = args.shift.upcase.to_sym
203
203
 
204
- if (args.length == 0) || (!args[0])
204
+ if args.empty? || !args[0]
205
205
  action_id = 0
206
206
  else
207
207
  action_id = args[0].to_i
@@ -209,35 +209,11 @@ private
209
209
 
210
210
  if action == :DRIVER_CANCEL
211
211
  cancel_action(action_id)
212
- log(action_id,"Driver command for #{action_id} cancelled")
212
+ log(action_id, "Driver command for #{action_id} cancelled")
213
213
  else
214
- trigger_action(action,action_id,*args)
214
+ trigger_action(action, action_id, *args)
215
215
  end
216
216
  end
217
217
  end
218
- end
219
-
220
- ################################################################
221
- ################################################################
222
-
223
- if __FILE__ == $0
224
-
225
- class SampleDriver < OpenNebulaDriver
226
- def initialize
227
- super(15,true)
228
-
229
- register_action(:SLEEP,method("my_sleep"))
230
- end
231
-
232
- def my_sleep(num, timeout)
233
- log(num,"Sleeping #{timeout} seconds")
234
- sleep(timeout.to_i)
235
- log(num,"Done with #{num}")
236
-
237
- send_message("SLEEP",RESULT[:success],num.to_s)
238
- end
239
- end
240
218
 
241
- sd = SampleDriver.new
242
- sd.start_driver
243
219
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 = '5.10.4'
54
+ VERSION = '5.12.0'
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-2019, OpenNebula Project, OpenNebula Systems
232
+ Copyright 2002-2020, 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
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -74,5 +74,5 @@ require 'opennebula/hook_log'
74
74
  module OpenNebula
75
75
 
76
76
  # OpenNebula version
77
- VERSION = '5.10.4'
77
+ VERSION = '5.12.0'
78
78
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2020, 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 #