opennebula 5.11.80.pre → 5.12.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d2d83b29c5331f619c3b5aa1213b82f3e078663
4
- data.tar.gz: bc41b7188c837d471cec3644d6a8aa780b60b4bd
3
+ metadata.gz: 9b77dc0532f6cfb629081a6de695a1255d5d0afd
4
+ data.tar.gz: 7568d30195b4a031c263300279f3c98602bf3fe0
5
5
  SHA512:
6
- metadata.gz: c20c193b8023d56b1a5c3d44a1468a0d9c90bc0d4f234f451a6e8f9a1444d0bfc6fc2e85d40763cf82fac95ab833167c03b8f212b81e5feb9a991057e81c9d82
7
- data.tar.gz: 6b57f21dad920d7fe9d159d2cc46d9e55f50b8fbf8063790d2fd48ebbd75d6aade3051f7d0902e40764f95d632b938a2de2ac1058b490c0b290b4d5520fbb6cc
6
+ metadata.gz: 8fb01acb555f25d1e3e0578c321c054fcb83f7a6f25b841defa07ba633a6540547dac67f96c7270b271336164f2db04f2aac4104eb9eac018bd71ef47c50dc80
7
+ data.tar.gz: 265caa4291b12f82446d82d74aea931796451babba552bad80c3b8fe05e0d4a088a0080cf9ae7c7530927201dc4cce6dc1caf3004d848408dbece181dd986dd5
@@ -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
 
@@ -97,7 +97,7 @@ class OpenNebulaDriver < ActionManager
97
97
  command = action_command_line(aname, params, options[:script_name])
98
98
 
99
99
  if action_is_local?(aname)
100
- stdin = Base64.strict_encode64(options[:stdin])
100
+ stdin = Base64.strict_encode64(options[:stdin].to_s)
101
101
  execution = LocalCommand.run(command,
102
102
  log_method(id),
103
103
  stdin,
@@ -51,7 +51,7 @@ end
51
51
  module CloudClient
52
52
 
53
53
  # OpenNebula version
54
- VERSION = '5.11.80'
54
+ VERSION = '5.12.0.1'
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.80'
77
+ VERSION = '5.12.0.1'
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|
@@ -239,7 +247,8 @@ module OpenNebula
239
247
  vi_client = VCenterDriver::VIClient.new_from_host(self["ID"])
240
248
  importer = VCenterDriver::VmmImporter.new(@client, vi_client)
241
249
 
242
- return importer.import({wild: wild, template: template, one_item: vm, host: self['ID']})
250
+ return importer.import({wild: wild, template: template,
251
+ one_item: vm, host: self['ID']})
243
252
  else
244
253
  rc = vm.allocate(template)
245
254
 
@@ -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
@@ -64,9 +64,8 @@ class OpenNebula::LdapAuth
64
64
  }
65
65
  end
66
66
 
67
- if !@options[:rfc2307bis]
68
- @options[:attributes] << @options[:user_field]
69
- end
67
+ # always fetch user_filed to compare whitespace diff
68
+ @options[:attributes] << @options[:user_field]
70
69
 
71
70
  # fetch the user group field only if we need that
72
71
  if @options[:group] or !@options[:rfc2307bis]
@@ -143,15 +142,20 @@ class OpenNebula::LdapAuth
143
142
 
144
143
  if result && result.first
145
144
  @user = result.first
146
- [@user.dn, @user[@options[:user_group_field]]]
145
+
146
+ [@user.dn,
147
+ @user[@options[:user_field]].first,
148
+ @user[@options[:user_group_field]]]
147
149
  else
148
150
  result=@ldap.search(:base => name)
149
151
 
150
152
  if result && result.first
151
153
  @user = result.first
152
- [name, @user[@options[:user_group_field]]]
154
+ [name,
155
+ @user[@options[:user_field]].first,
156
+ @user[@options[:user_group_field]]]
153
157
  else
154
- [nil, nil]
158
+ [nil, nil, nil]
155
159
  end
156
160
  end
157
161
  end
@@ -218,3 +222,68 @@ class OpenNebula::LdapAuth
218
222
  groups.compact.uniq
219
223
  end
220
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
@@ -192,8 +192,9 @@ module OpenNebula
192
192
  options[:vmtemplate_name] = name unless options[:vmtemplate_name]
193
193
 
194
194
  tmpl << "\n"
195
- tmpl << "NAME=\"" << name << "\"\n"
196
- tmpl << "FROM_APP=\"" << self['ID'] << "\"\n"
195
+ tmpl << 'NAME="' << name << "\"\n"
196
+ tmpl << 'FROM_APP="' << self['ID'] << "\"\n"
197
+ tmpl << 'URL_ARGS="' << options[:url_args] << "\"\n" if options[:url_args]
197
198
 
198
199
  case type_str
199
200
  when 'IMAGE'
@@ -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.80.pre
4
+ version: 5.12.0.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-07 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -88,10 +88,8 @@ files:
88
88
  - lib/opennebula/image_pool.rb
89
89
  - lib/opennebula/marketplace.rb
90
90
  - lib/opennebula/marketplace_pool.rb
91
- - lib/opennebula/marketplaceapp.rb
92
91
  - lib/opennebula/marketplaceapp_pool.rb
93
92
  - lib/opennebula/oneflow_client.rb
94
- - lib/opennebula/pool.rb
95
93
  - lib/opennebula/pool_element.rb
96
94
  - lib/opennebula/security_group.rb
97
95
  - lib/opennebula/security_group_pool.rb
@@ -103,7 +101,6 @@ files:
103
101
  - lib/opennebula/utils.rb
104
102
  - lib/opennebula/vdc.rb
105
103
  - lib/opennebula/vdc_pool.rb
106
- - lib/opennebula/virtual_machine.rb
107
104
  - lib/opennebula/virtual_machine_pool.rb
108
105
  - lib/opennebula/virtual_network.rb
109
106
  - lib/opennebula/virtual_network_pool.rb
@@ -118,6 +115,9 @@ files:
118
115
  - lib/opennebula/xml_utils.rb
119
116
  - lib/opennebula/zone.rb
120
117
  - lib/opennebula/zone_pool.rb
118
+ - lib/opennebula/marketplaceapp.rb
119
+ - lib/opennebula/pool.rb
120
+ - lib/opennebula/virtual_machine.rb
121
121
  - lib/opennebula/ldap_auth.rb
122
122
  - lib/opennebula/ldap_auth_spec.rb
123
123
  - lib/opennebula/server_cipher_auth.rb
@@ -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