Module: OpenNebula

Defined in:
opennebula/document_pool_json.rb,
opennebula.rb,
opennebula/acl.rb,
opennebula/acl_pool.rb,
opennebula/client.rb,
opennebula/cluster.rb,
opennebula/cluster_pool.rb,
opennebula/datastore.rb,
opennebula/datastore_pool.rb,
opennebula/document.rb,
opennebula/document_json.rb,
opennebula/document_pool.rb,
opennebula/error.rb,
opennebula/group.rb,
opennebula/group_pool.rb,
opennebula/host.rb,
opennebula/host_pool.rb,
opennebula/image.rb,
opennebula/image_pool.rb,
opennebula/pool.rb,
opennebula/pool_element.rb,
opennebula/system.rb,
opennebula/template.rb,
opennebula/template_pool.rb,
opennebula/user.rb,
opennebula/user_pool.rb,
opennebula/virtual_machine.rb,
opennebula/virtual_machine_pool.rb,
opennebula/virtual_network.rb,
opennebula/virtual_network_pool.rb,
opennebula/xml_element.rb,
opennebula/xml_pool.rb,
opennebula/xml_utils.rb

Overview

-------------------------------------------------------------------------- # Copyright 2002-2013, 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. # --------------------------------------------------------------------------- #

Defined Under Namespace

Classes: Acl, AclPool, Client, Cluster, ClusterPool, Datastore, DatastorePool, Document, DocumentJSON, DocumentPool, DocumentPoolJSON, Error, Group, GroupPool, Host, HostPool, Image, ImagePool, NokogiriStreamParser, Pool, PoolElement, System, Template, TemplatePool, User, UserPool, VirtualMachine, VirtualMachinePool, VirtualNetwork, VirtualNetworkPool, XMLElement, XMLPool

Constant Summary

VERSION =

OpenNebula version

'4.2.0'

Class Method Summary (collapse)

Class Method Details

+ (Boolean) is_error?(value)

Returns true if the object returned by a method of the OpenNebula library is an Error

Returns:

  • (Boolean)


49
50
51
# File 'opennebula/error.rb', line 49

def self.is_error?(value)
    value.class==OpenNebula::Error
end

+ (Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with the requested xpath expressions, and an Array of [timestamp, value].) process_monitoring(xmldoc, root_elem, timestamp_elem, oid, xpath_expressions)

Processes the monitoring data in XML returned by OpenNebula

Parameters:

  • xmldoc (XMLElement)

    monitoring data returned by OpenNebula

  • root_elem (String)

    Root for each individual PoolElement

  • timestamp_elem (String)

    Name of the XML element with the last monitorization timestamp

  • oid (Integer)

    Id of the object to process

  • xpath_expressions (Array<String>)

    Elements to retrieve.

Returns:

  • (Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with the requested xpath expressions, and an Array of [timestamp, value].)

    Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with the requested xpath expressions, and an Array of [timestamp, value].



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File '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