opennebula 5.11.85.pre → 5.12.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7c0463980bb481a313fecfe5d21893587dfddcb
4
- data.tar.gz: f73c74b057353fa3bd81e33271f51ad7093fb2e2
3
+ metadata.gz: 96499142488225ad551ee8d92cf799f87253bd6b
4
+ data.tar.gz: ea7c24712ca84f090d36bd7c8cdd94b3a6df1235
5
5
  SHA512:
6
- metadata.gz: f940626641eea5bb9d66aa1b5aa45a89b9c6e870173104308a30e53c52eed979777978acb23dd0094b746f7dbca26a59b4dd3a4fba1a0b930ec54969852e2c5e
7
- data.tar.gz: 17f00e8678bca2183a3f897ff3705220cc5d8bc8ba5b36955fc85f081b0aeac11bfda3abeba6f0da68bd0539da7222205bffa3b4e2043ef723bae706a2e0b65c
6
+ metadata.gz: c29d00cfc89b6ce30941f87d5d19f6e30024532b2bba6f6942872a1d016f05a4589b0d2a3a08922fbaa89c9533b325142e8afd9ab348a545a6b0c1ac1621c10d
7
+ data.tar.gz: 4b3d3c880829e69d53c8f75d2e843c2e1a7d2f292bdb779df5851dba0c29d09863ec945193595938009b6d2c6dd8d9c2566914cbf237f32aed7f44e33a862f6a
@@ -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
 
@@ -51,7 +51,7 @@ end
51
51
  module CloudClient
52
52
 
53
53
  # OpenNebula version
54
- VERSION = '5.11.85'
54
+ VERSION = '5.12.2'
55
55
 
56
56
  # #########################################################################
57
57
  # Default location for the authentication file
@@ -74,5 +74,5 @@ require 'opennebula/hook_log'
74
74
  module OpenNebula
75
75
 
76
76
  # OpenNebula version
77
- VERSION = '5.11.85'
77
+ VERSION = '5.12.2'
78
78
  end
@@ -41,7 +41,7 @@ module OpenNebula
41
41
 
42
42
  hash['DOCUMENT_POOL']['DOCUMENT'].each { |doc|
43
43
  body = doc['TEMPLATE']["#{TEMPLATE_TAG}"]
44
- if body
44
+ if body && !body.empty?
45
45
  b_hash = JSON.parse(body)
46
46
  doc['TEMPLATE']["#{TEMPLATE_TAG}"] = b_hash
47
47
  end
@@ -55,4 +55,4 @@ module OpenNebula
55
55
  end
56
56
  end
57
57
  end
58
- end
58
+ end
@@ -125,6 +125,14 @@ module OpenNebula
125
125
  set_status("OFFLINE")
126
126
  end
127
127
 
128
+ #Resets monitoring forcing an update
129
+ def forceupdate()
130
+ rc = offline
131
+ return rc if OpenNebula.is_error?(rc)
132
+
133
+ enable
134
+ end
135
+
128
136
  def flush(action)
129
137
  self.disable
130
138
 
@@ -134,7 +142,7 @@ module OpenNebula
134
142
  rc = vm_pool.info
135
143
  if OpenNebula.is_error?(rc)
136
144
  puts rc.message
137
- exit -1
145
+ exit(-1)
138
146
  end
139
147
 
140
148
  vm_pool.each do |vm|
@@ -99,9 +99,16 @@ module OpenNebula
99
99
 
100
100
  # Retrieves the monitoring data for all the Hosts in the pool, in XML
101
101
  #
102
+ # @param [Integer] num Optional Retrieve monitor records in the last num
103
+ # seconds. 0 just the last record, -1 or nil all records
104
+ #
102
105
  # @return [String] VM monitoring data, in XML
103
- def monitoring_xml()
104
- return @client.call(HOST_POOL_METHODS[:monitoring])
106
+ def monitoring_xml(num = nil)
107
+ return @client.call(HOST_POOL_METHODS[:monitoring]) if num.nil?
108
+
109
+ @client.call(HOST_POOL_METHODS[:monitoring], num.to_i)
105
110
  end
111
+
106
112
  end
113
+
107
114
  end
@@ -222,3 +222,68 @@ class OpenNebula::LdapAuth
222
222
  groups.compact.uniq
223
223
  end
224
224
  end
225
+
226
+
227
+ # ---------------------------------------------------------------------------- #
228
+ # Helper functions to parse ldap_auth.conf server entries
229
+ # ---------------------------------------------------------------------------- #
230
+ def to_array(name)
231
+ if name.is_a? Array
232
+ name
233
+ elsif name.is_a? Hash
234
+ if name.keys.size == 1
235
+ [name.values].flatten
236
+ else
237
+ STDERR.puts "invalid group configuration: #{name}"
238
+ exit(-1)
239
+ end
240
+ else
241
+ [name]
242
+ end
243
+ end
244
+
245
+ def get_server_order(opts, user)
246
+ order = []
247
+
248
+ if opts[:order] && opts[:match_user_regex]
249
+ STDERR.puts ":order and :match_user_regex are mutually exclusive"
250
+ exit(-1)
251
+ end
252
+
253
+ if opts[:order]
254
+ if opts[:order].class != Array
255
+ STDERR.puts ":order value malformed, must be an Array"
256
+ exit(-1)
257
+ end
258
+
259
+ opts[:order].each do |name|
260
+ order << to_array(name)
261
+ end
262
+
263
+ elsif opts[:match_user_regex]
264
+ if opts[:match_user_regex].class != Hash || opts[:match_user_regex].empty?
265
+ STDERR.puts ":match_user_regex value malformed, must be an Hash"
266
+ exit(-1)
267
+ end
268
+
269
+ opts[:match_user_regex].each do |regex, server|
270
+ if m = user.match(/#{regex}/i)
271
+
272
+ # update user with the capture
273
+ user = m[1] if m[1]
274
+
275
+ order << to_array(server)
276
+ end
277
+ end
278
+
279
+ if order.empty?
280
+ STDERR.puts "User #{user} does not mach any regex"
281
+ end
282
+
283
+ else
284
+ STDERR.puts "missing either :order or :match_user_regex in configuration"
285
+ exit(-1)
286
+ end
287
+
288
+ return [order, user]
289
+ end
@@ -122,6 +122,7 @@ module OpenNebula
122
122
  DISK_RESIZE
123
123
  DISK_RESIZE_POWEROFF
124
124
  DISK_RESIZE_UNDEPLOYED
125
+ HOTPLUG_NIC_POWEROFF
125
126
  }
126
127
 
127
128
  SHORT_VM_STATES={
@@ -202,7 +203,8 @@ module OpenNebula
202
203
  "PROLOG_MIGRATE_UNKNOWN_FAILURE" => "fail",
203
204
  "DISK_RESIZE" => "drsz",
204
205
  "DISK_RESIZE_POWEROFF" => "drsz",
205
- "DISK_RESIZE_UNDEPLOYED" => "drsz"
206
+ "DISK_RESIZE_UNDEPLOYED" => "drsz",
207
+ "HOTPLUG_NIC_POWEROFF" => "hotp"
206
208
  }
207
209
 
208
210
  HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard
@@ -199,10 +199,13 @@ module OpenNebula
199
199
  #
200
200
  # @param [Integer] filter_flag Optional filter flag to retrieve all or
201
201
  # part of the Pool. Possible values: INFO_ALL, INFO_GROUP, INFO_MINE.
202
- #
202
+ # @param [Integer] num Optional Retrieve monitor records in the last num
203
+ # seconds. 0 just the last record, -1 or nil all records
203
204
  # @return [String] VM monitoring data, in XML
204
- def monitoring_xml(filter_flag=INFO_ALL)
205
- return @client.call(VM_POOL_METHODS[:monitoring], filter_flag)
205
+ def monitoring_xml(filter_flag=INFO_ALL, num=nil)
206
+ return @client.call(VM_POOL_METHODS[:monitoring], filter_flag) if num.nil?
207
+
208
+ @client.call(VM_POOL_METHODS[:monitoring], filter_flag, num.to_i)
206
209
  end
207
210
 
208
211
  # Processes all the history records, and stores the monthly cost for
@@ -37,8 +37,9 @@ end
37
37
  ENV['LANG'] = 'C'
38
38
 
39
39
  if File.directory?(GEMS_LOCATION)
40
- Gem.use_paths(GEMS_LOCATION)
41
- $LOAD_PATH.reject! {|l| l =~ /(vendor|site)_ruby/ }
40
+ $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
41
+ require 'rubygems'
42
+ Gem.use_paths(File.realpath(GEMS_LOCATION))
42
43
  end
43
44
 
44
45
  $LOAD_PATH << LIB_LOCATION + '/ruby/vendors/rbvmomi/lib'
@@ -81,7 +82,7 @@ require 'resolv'
81
82
  # vCenter Library #
82
83
  # ---------------------------------------------------------------------------- #
83
84
 
84
- require 'vcenter_importer.rb'
85
+ require 'vcenter_importer'
85
86
  require 'memoize'
86
87
  require 'vi_client'
87
88
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.11.85.pre
4
+ version: 5.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -142,9 +142,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - '>'
145
+ - - '>='
146
146
  - !ruby/object:Gem::Version
147
- version: 1.3.1
147
+ version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
150
  rubygems_version: 2.0.14.1