opennebula 5.10.5 → 5.11.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 +1 -1
- data/lib/DriverExecHelper.rb +19 -18
- data/lib/OpenNebulaDriver.rb +38 -62
- data/lib/VirtualMachineDriver.rb +1 -1
- data/lib/cloud/CloudClient.rb +3 -3
- data/lib/opennebula.rb +2 -2
- data/lib/opennebula/acl.rb +1 -1
- data/lib/opennebula/acl_pool.rb +1 -1
- data/lib/opennebula/client.rb +1 -1
- data/lib/opennebula/cluster.rb +1 -1
- data/lib/opennebula/cluster_pool.rb +1 -1
- data/lib/opennebula/datastore.rb +1 -1
- 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 +2 -2
- data/lib/opennebula/document_pool_json.rb +1 -1
- data/lib/opennebula/error.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 +2 -3
- data/lib/opennebula/host_pool.rb +2 -3
- data/lib/opennebula/image.rb +1 -1
- data/lib/opennebula/image_pool.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +14 -13
- data/lib/opennebula/ldap_auth_spec.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_pool.rb +1 -1
- data/lib/opennebula/oneflow_client.rb +24 -3
- data/lib/opennebula/pool.rb +4 -10
- data/lib/opennebula/pool_element.rb +9 -37
- 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 +1 -1
- data/lib/opennebula/system.rb +3 -3
- data/lib/opennebula/template.rb +1 -1
- 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 +5 -6
- data/lib/opennebula/virtual_machine_pool.rb +3 -4
- data/lib/opennebula/virtual_network.rb +9 -3
- 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/x509_auth.rb +1 -1
- 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/vcenter_driver.rb +8 -2
- metadata +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/error.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/group.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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-
|
|
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 #
|
data/lib/opennebula/hook.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/hook_log.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/hook_pool.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/host.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -184,8 +184,7 @@ module OpenNebula
|
|
|
184
184
|
# ["1337266088", "800"]]
|
|
185
185
|
# }
|
|
186
186
|
def monitoring(xpath_expressions)
|
|
187
|
-
return super(HOST_METHODS[:monitoring],
|
|
188
|
-
'LAST_MON_TIME', xpath_expressions)
|
|
187
|
+
return super(HOST_METHODS[:monitoring], xpath_expressions)
|
|
189
188
|
end
|
|
190
189
|
|
|
191
190
|
# Retrieves this Host's monitoring data from OpenNebula, in XML
|
data/lib/opennebula/host_pool.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -94,8 +94,7 @@ module OpenNebula
|
|
|
94
94
|
# "HOST_SHARE/FREE_CPU"=>[["1337609673", "800"]],
|
|
95
95
|
# "HOST_SHARE/RUNNING_VMS"=>[["1337609673", "3"]]}}
|
|
96
96
|
def monitoring(xpath_expressions)
|
|
97
|
-
return super(HOST_POOL_METHODS[:monitoring],
|
|
98
|
-
'HOST', 'LAST_MON_TIME', xpath_expressions)
|
|
97
|
+
return super(HOST_POOL_METHODS[:monitoring], xpath_expressions)
|
|
99
98
|
end
|
|
100
99
|
|
|
101
100
|
# Retrieves the monitoring data for all the Hosts in the pool, in XML
|
data/lib/opennebula/image.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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-
|
|
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 #
|
data/lib/opennebula/ldap_auth.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ---------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -50,7 +50,8 @@ class OpenNebula::LdapAuth
|
|
|
50
50
|
:mapping_key => 'GROUP_DN',
|
|
51
51
|
:mapping_default => 1,
|
|
52
52
|
:attributes => [ "memberOf" ],
|
|
53
|
-
:rfc2307bis => true
|
|
53
|
+
:rfc2307bis => true,
|
|
54
|
+
:group_admin_group_dn => nil
|
|
54
55
|
}.merge(options)
|
|
55
56
|
|
|
56
57
|
ops={}
|
|
@@ -190,26 +191,26 @@ class OpenNebula::LdapAuth
|
|
|
190
191
|
end
|
|
191
192
|
|
|
192
193
|
def get_groups
|
|
193
|
-
groups = []
|
|
194
|
-
|
|
195
194
|
if @options[:rfc2307bis]
|
|
196
|
-
[@user['memberOf']].flatten
|
|
197
|
-
if (g = in_hash_ignore_case?(@mapping, group))
|
|
198
|
-
groups << @mapping[g]
|
|
199
|
-
end
|
|
200
|
-
end
|
|
195
|
+
ldap_groups = [@user['memberOf']].flatten
|
|
201
196
|
else
|
|
202
197
|
group_base = @options[:group_base] ? @options[:group_base] : @options[:base]
|
|
203
198
|
filter = Net::LDAP::Filter.equals(@options[:group_field], @user[@options[:user_group_field]].first)
|
|
204
|
-
@ldap.search(
|
|
199
|
+
ldap_groups = @ldap.search(
|
|
205
200
|
:base => group_base,
|
|
206
201
|
:attributes => [ "dn" ],
|
|
207
202
|
:filter => filter
|
|
208
|
-
)
|
|
209
|
-
|
|
203
|
+
).map! { |entry| entry.dn }
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
groups = []
|
|
207
|
+
ldap_groups.each do |group|
|
|
208
|
+
if (g = in_hash_ignore_case?(@mapping, group))
|
|
209
|
+
if ldap_groups.include? @options[:group_admin_group_dn]
|
|
210
|
+
groups << "*#{@mapping[g]}"
|
|
211
|
+
else
|
|
210
212
|
groups << @mapping[g]
|
|
211
213
|
end
|
|
212
|
-
|
|
213
214
|
end
|
|
214
215
|
end
|
|
215
216
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ---------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 #
|
|
@@ -36,7 +36,12 @@ module Role
|
|
|
36
36
|
'reboot-hard',
|
|
37
37
|
'poweroff',
|
|
38
38
|
'poweroff-hard',
|
|
39
|
-
'snapshot-create'
|
|
39
|
+
'snapshot-create',
|
|
40
|
+
'snapshot-revert',
|
|
41
|
+
'snapshot-delete',
|
|
42
|
+
'disk-snapshot-create',
|
|
43
|
+
'disk-snapshot-revert',
|
|
44
|
+
'disk-snapshot-delete'
|
|
40
45
|
]
|
|
41
46
|
|
|
42
47
|
STATE = {
|
|
@@ -285,7 +290,7 @@ module Service
|
|
|
285
290
|
exit_code = 0
|
|
286
291
|
|
|
287
292
|
ids.each do |id|
|
|
288
|
-
response = block.call(id)
|
|
293
|
+
response = block.call(id) if block_given?
|
|
289
294
|
|
|
290
295
|
if CloudClient::is_error?(response)
|
|
291
296
|
puts response.to_s
|
|
@@ -296,6 +301,22 @@ module Service
|
|
|
296
301
|
exit_code
|
|
297
302
|
end
|
|
298
303
|
|
|
304
|
+
# Perform an action on a resource
|
|
305
|
+
# @param [Integer] id resource id
|
|
306
|
+
# @param [Block] block action to be performed
|
|
307
|
+
# @return [Integer] exit_code
|
|
308
|
+
def self.perform_action(id, &block)
|
|
309
|
+
exit_code = 0
|
|
310
|
+
response = block.call(id) if block_given?
|
|
311
|
+
|
|
312
|
+
if CloudClient::is_error?(response)
|
|
313
|
+
puts response.to_s
|
|
314
|
+
exit_code = response.code.to_i
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
exit_code
|
|
318
|
+
end
|
|
319
|
+
|
|
299
320
|
class Client
|
|
300
321
|
def initialize(opts={})
|
|
301
322
|
@username = opts[:username] || ENV['ONEFLOW_USER']
|
data/lib/opennebula/pool.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -91,9 +91,6 @@ module OpenNebula
|
|
|
91
91
|
# Retrieves the monitoring data for all the Objects in the pool
|
|
92
92
|
#
|
|
93
93
|
# @param [String] xml_method xml-rcp method
|
|
94
|
-
# @param [String] root_elem Root for each individual PoolElement
|
|
95
|
-
# @param [String] timestamp_elem Name of the XML element with the last
|
|
96
|
-
# monitorization timestamp
|
|
97
94
|
# @param [Array<String>] xpath_expressions Elements to retrieve.
|
|
98
95
|
# @param args arguemnts for the xml_method call
|
|
99
96
|
#
|
|
@@ -101,8 +98,7 @@ module OpenNebula
|
|
|
101
98
|
# OpenNebula::Error] The first level hash uses the Object ID as keys,
|
|
102
99
|
# and as value a Hash with the requested xpath expressions,
|
|
103
100
|
# and an Array of 'timestamp, value'.
|
|
104
|
-
def monitoring(xml_method,
|
|
105
|
-
*args)
|
|
101
|
+
def monitoring(xml_method, xpaths, *args)
|
|
106
102
|
|
|
107
103
|
rc = @client.call(xml_method, *args)
|
|
108
104
|
|
|
@@ -116,7 +112,7 @@ module OpenNebula
|
|
|
116
112
|
hash = {}
|
|
117
113
|
|
|
118
114
|
# Get all existing Object IDs
|
|
119
|
-
ids = xmldoc.retrieve_elements(
|
|
115
|
+
ids = xmldoc.retrieve_elements('/MONITORING_DATA/MONITORING/ID')
|
|
120
116
|
|
|
121
117
|
if ids.nil?
|
|
122
118
|
return hash
|
|
@@ -125,9 +121,7 @@ module OpenNebula
|
|
|
125
121
|
end
|
|
126
122
|
|
|
127
123
|
ids.each { |id|
|
|
128
|
-
hash[id] = OpenNebula.process_monitoring(
|
|
129
|
-
xmldoc, root_elem, timestamp_elem, id, xpath_expressions)
|
|
130
|
-
|
|
124
|
+
hash[id] = OpenNebula.process_monitoring(xmldoc, id, xpaths)
|
|
131
125
|
}
|
|
132
126
|
|
|
133
127
|
return hash
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -183,15 +183,12 @@ module OpenNebula
|
|
|
183
183
|
# Retrieves this Element's monitoring data from OpenNebula
|
|
184
184
|
#
|
|
185
185
|
# @param [String] xml_method the name of the XML-RPC method
|
|
186
|
-
# @param [String]
|
|
187
|
-
#
|
|
188
|
-
# monitorization timestamp
|
|
189
|
-
# @param xpath_expressions [Array<String>] Xpath expressions for the
|
|
190
|
-
# elements to retrieve.
|
|
186
|
+
# @param xpaths [Array<String>] Xpath expressions for the elements to
|
|
187
|
+
# retrieve.
|
|
191
188
|
#
|
|
192
189
|
# @return [Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with
|
|
193
190
|
# the requested xpath expressions, and an Array of [timestamp, value].
|
|
194
|
-
def monitoring(xml_method,
|
|
191
|
+
def monitoring(xml_method, xpaths)
|
|
195
192
|
return Error.new('ID not defined') if !@pe_id
|
|
196
193
|
|
|
197
194
|
rc = @client.call(xml_method, @pe_id)
|
|
@@ -204,8 +201,7 @@ module OpenNebula
|
|
|
204
201
|
xmldoc.initialize_xml(rc, 'MONITORING_DATA')
|
|
205
202
|
|
|
206
203
|
|
|
207
|
-
return OpenNebula.process_monitoring(
|
|
208
|
-
xmldoc, root_elem, timestamp_elem, @pe_id, xpath_expressions)
|
|
204
|
+
return OpenNebula.process_monitoring(xmldoc, @pe_id, xpaths)
|
|
209
205
|
end
|
|
210
206
|
|
|
211
207
|
public
|
|
@@ -261,21 +257,20 @@ module OpenNebula
|
|
|
261
257
|
# Processes the monitoring data in XML returned by OpenNebula
|
|
262
258
|
#
|
|
263
259
|
# @param [XMLElement] xmldoc monitoring data returned by OpenNebula
|
|
264
|
-
# @param [String] root_elem Root for each individual PoolElement
|
|
265
|
-
# @param [String] timestamp_elem Name of the XML element with the last
|
|
266
260
|
# monitorization timestamp
|
|
267
261
|
# @param [Integer] oid Id of the object to process
|
|
268
262
|
# @param [Array<String>] xpath_expressions Elements to retrieve.
|
|
269
263
|
#
|
|
270
264
|
# @return [Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with
|
|
271
265
|
# the requested xpath expressions, and an Array of [timestamp, value].
|
|
272
|
-
def self.process_monitoring(xmldoc,
|
|
266
|
+
def self.process_monitoring(xmldoc, oid, xpath_expressions)
|
|
273
267
|
hash = {}
|
|
274
268
|
timestamps = xmldoc.retrieve_elements(
|
|
275
|
-
"
|
|
269
|
+
"/MONITORING_DATA/MONITORING[ID=#{oid}]/TIMESTAMP")
|
|
276
270
|
|
|
277
271
|
xpath_expressions.each { |xpath|
|
|
278
|
-
xpath_values = xmldoc.retrieve_elements(
|
|
272
|
+
xpath_values = xmldoc.retrieve_elements(
|
|
273
|
+
"/MONITORING_DATA/MONITORING[ID=#{oid}]/#{xpath}")
|
|
279
274
|
|
|
280
275
|
if ( xpath_values.nil? )
|
|
281
276
|
hash[xpath] = []
|
|
@@ -287,27 +282,4 @@ module OpenNebula
|
|
|
287
282
|
return hash
|
|
288
283
|
end
|
|
289
284
|
|
|
290
|
-
# Alternative method with better performance for huge number of timestamps.
|
|
291
|
-
# For reasonable amounts of data, the current method is quicker
|
|
292
|
-
=begin
|
|
293
|
-
def self.process_monitoring(xmldoc, root_elem, timestamp_elem, oid, xpath_expressions)
|
|
294
|
-
hash = {}
|
|
295
|
-
|
|
296
|
-
xpath_expressions.each { |xpath|
|
|
297
|
-
hash[xpath] = []
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
xmldoc.each("#{root_elem}[ID=#{oid}]") do |elem|
|
|
301
|
-
timestamp = elem[timestamp_elem]
|
|
302
|
-
|
|
303
|
-
xpath_expressions.each { |xpath|
|
|
304
|
-
xpath_value = elem[xpath]
|
|
305
|
-
|
|
306
|
-
hash[xpath] << [timestamp, xpath_value] if !xpath_value.nil?
|
|
307
|
-
}
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
return hash
|
|
311
|
-
end
|
|
312
|
-
=end
|
|
313
285
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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-
|
|
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-
|
|
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-
|
|
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 #
|
data/lib/opennebula/ssh_auth.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
data/lib/opennebula/system.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -60,7 +60,7 @@ module OpenNebula
|
|
|
60
60
|
|
|
61
61
|
# Executes a SQL query command on OpenNebula DB
|
|
62
62
|
# @param [String] Sql string
|
|
63
|
-
# @return [String, OpenNebula::Error] Sql execution result in XML
|
|
63
|
+
# @return [String, OpenNebula::Error] Sql execution result in XML
|
|
64
64
|
# format in case of success, Error otherwise
|
|
65
65
|
# <QUERY>
|
|
66
66
|
# the query sent to oned
|
|
@@ -110,7 +110,7 @@ module OpenNebula
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
config = XMLElement.new
|
|
113
|
-
config.initialize_xml(rc, '
|
|
113
|
+
config.initialize_xml(rc, 'OPENNEBULA_CONFIGURATION')
|
|
114
114
|
|
|
115
115
|
return config
|
|
116
116
|
end
|