module OpenNebula
————————————————————————– # Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
#
Licensed under the Apache License, Version 2.0 (the “License”); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at #
#
www.apache.org/licenses/LICENSE-2.0 #
#
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an “AS IS” BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
————————————————————————– # Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
#
Licensed under the Apache License, Version 2.0 (the “License”); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at #
#
www.apache.org/licenses/LICENSE-2.0 #
#
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an “AS IS” BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
————————————————————————– # Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
#
Licensed under the Apache License, Version 2.0 (the “License”); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at #
#
www.apache.org/licenses/LICENSE-2.0 #
#
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an “AS IS” BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
————————————————————————– # Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
#
Licensed under the Apache License, Version 2.0 (the “License”); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at #
#
www.apache.org/licenses/LICENSE-2.0 #
#
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an “AS IS” BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
Constants
- DEFAULT_POOL_PAGE_SIZE
- NOKOGIRI
- OX
- REXML_FORMATTERS
- VERSION
OpenNebula version
Public Class Methods
Returns true if the object returned by a method of the OpenNebula library is an Error
# File lib/opennebula/error.rb, line 49 def self.is_error?(value) value.class==OpenNebula::Error end
# File lib/opennebula/client.rb, line 24 def self.pool_page_size @@pool_page_size end
Processes the monitoring data in XML returned by OpenNebula
@param [XMLElement] xmldoc monitoring data returned by OpenNebula @param [String] root_elem Root for each individual PoolElement @param [String] timestamp_elem Name of the XML element with the last
monitorization timestamp
@param [Integer] oid Id of the object to process @param [Array<String>] xpath_expressions Elements to retrieve.
@return [Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with
the requested xpath expressions, and an Array of [timestamp, value].
# File lib/opennebula/pool_element.rb, line 250 def self.process_monitoring(xmldoc, root_elem, timestamp_elem, oid, xpath_expressions) hash = {} timestamps = xmldoc.retrieve_elements( "#{root_elem}[ID=#{oid}]/#{timestamp_elem}") xpath_expressions.each { |xpath| xpath_values = xmldoc.retrieve_elements("#{root_elem}[ID=#{oid}]/#{xpath}") if ( xpath_values.nil? ) hash[xpath] = [] else hash[xpath] = timestamps.zip(xpath_values) end } return hash end