
Constants
CLUSTER_METHODS | = | { :info => "cluster.info", :allocate => "cluster.allocate", :delete => "cluster.delete", :addhost => "cluster.add", :removehost => "cluster.remove", } |
Constants and Class Methods |
Public class methods
build_xml
(pe_id=nil)
Creates a Cluster description with just its identifier this method should be used to create plain Cluster objects. id the id of the user
Example:
cluster = Cluster.new(User.build_xml(3),rpc_client)
[show source]
# File OpenNebula/Cluster.rb, line 23 23: def Cluster.build_xml(pe_id=nil) 24: if pe_id 25: user_xml = "<CLUSTER><ID>#{pe_id}</ID></CLUSTER>" 26: else 27: user_xml = "<CLUSTER></CLUSTER>" 28: end 29: 30: XMLElement.build_xml(user_xml,'CLUSTER') 31: end
new
(xml, client)
Class constructor
[show source]
# File OpenNebula/Cluster.rb, line 36 36: def initialize(xml, client) 37: super(xml,client) 38: 39: @client = client 40: end
Public instance methods
add_host
(host_id)
[show source]
# File OpenNebula/Cluster.rb, line 66 66: def add_host(host_id) 67: return Error.new('ID not defined') if !@pe_id 68: 69: rc = @client.call(CLUSTER_METHODS[:addhost], host_id.to_i, @pe_id) 70: rc = nil if !OpenNebula.is_error?(rc) 71: 72: return rc 73: end
allocate
(clustername)
Allocates a new Cluster in OpenNebula
clustername A string containing the name of the Cluster.
[show source]
# File OpenNebula/Cluster.rb, line 54 54: def allocate(clustername) 55: super(CLUSTER_METHODS[:allocate], clustername) 56: end
delete
()
Deletes the Cluster
[show source]
# File OpenNebula/Cluster.rb, line 59 59: def delete() 60: super(CLUSTER_METHODS[:delete]) 61: end
info
()
Retrieves the information of the given Cluster.
[show source]
# File OpenNebula/Cluster.rb, line 47 47: def info() 48: super(CLUSTER_METHODS[:info], 'CLUSTER') 49: end
remove_host
(host_id)
[show source]
# File OpenNebula/Cluster.rb, line 78 78: def remove_host(host_id) 79: return Error.new('ID not defined') if !@pe_id 80: 81: rc = @client.call(CLUSTER_METHODS[:removehost], host_id.to_i) 82: rc = nil if !OpenNebula.is_error?(rc) 83: 84: return rc 85: end