
The Pool class represents a generic OpenNebula Pool in XML format and provides the basic functionality to handle the Pool elements
Included modules
- Enumerable
Public class methods
new
(pool,element,client)
pool: | String XML name of the root element |
element: | String XML name of the Pool elements |
client: | Client represents a XML-RPC connection |
[show source]
# File OpenNebula/Pool.rb, line 29 29: def initialize(pool,element,client) 30: super(nil) 31: 32: @pool_name = pool.upcase 33: @element_name = element.upcase 34: 35: @client = client 36: @hash = nil 37: end
Public instance methods
each
(&block)
Iterates over every PoolElement in the Pool and calls the block with a a PoolElement obtained calling the factory method
block: | Block |
[show source]
# File OpenNebula/Pool.rb, line 73 73: def each(&block) 74: each_element(block) if @xml 75: end
to_str
()
DO NOT USE - ONLY REXML BACKEND
[show source]
# File OpenNebula/Pool.rb, line 78 78: def to_str 79: str = "" 80: REXML::Formatters::Pretty.new(1).write(@xml,str) 81: 82: return str 83: end
Protected instance methods
factory
(element_xml)
Default Factory Method for the Pools. The factory method returns an suitable PoolElement object. Each Pool MUST implement the corresponding factory method
element_xml: | XML XML element describing the pool element |
- return
- a PoolElement object
[show source]
# File OpenNebula/Pool.rb, line 44 44: def factory(element_xml) 45: OpenNebula::PoolElement.new(element_xml,client) 46: end
info
(xml_method,*args)
Calls to the corresponding info method to retreive the pool representation in XML format
xml_method: | String the name of the XML-RPC method |
args: | Array with additional arguments for the info call |
- return
- nil in case of success or an Error object
[show source]
# File OpenNebula/Pool.rb, line 57 57: def info(xml_method,*args) 58: rc = @client.call(xml_method,*args) 59: 60: if !OpenNebula.is_error?(rc) 61: initialize_xml(rc,@pool_name) 62: rc = nil 63: end 64: 65: return rc 66: end