
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 39 39: def Cluster.build_xml(pe_id=nil) 40: if pe_id 41: user_xml = "<CLUSTER><ID>#{pe_id}</ID></CLUSTER>" 42: else 43: user_xml = "<CLUSTER></CLUSTER>" 44: end 45: 46: XMLElement.build_xml(user_xml,'CLUSTER') 47: end
new
(xml, client)
Class constructor
[show source]
# File OpenNebula/Cluster.rb, line 52 52: def initialize(xml, client) 53: super(xml,client) 54: 55: @client = client 56: end
Public instance methods
add_host
(host_id)
[show source]
# File OpenNebula/Cluster.rb, line 82 82: def add_host(host_id) 83: return Error.new('ID not defined') if !@pe_id 84: 85: rc = @client.call(CLUSTER_METHODS[:addhost], host_id.to_i, @pe_id) 86: rc = nil if !OpenNebula.is_error?(rc) 87: 88: return rc 89: 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 70 70: def allocate(clustername) 71: super(CLUSTER_METHODS[:allocate], clustername) 72: end
delete
()
Deletes the Cluster
[show source]
# File OpenNebula/Cluster.rb, line 75 75: def delete() 76: super(CLUSTER_METHODS[:delete]) 77: end
info
()
Retrieves the information of the given Cluster.
[show source]
# File OpenNebula/Cluster.rb, line 63 63: def info() 64: super(CLUSTER_METHODS[:info], 'CLUSTER') 65: end
remove_host
(host_id)
[show source]
# File OpenNebula/Cluster.rb, line 94 94: def remove_host(host_id) 95: return Error.new('ID not defined') if !@pe_id 96: 97: rc = @client.call(CLUSTER_METHODS[:removehost], host_id.to_i) 98: rc = nil if !OpenNebula.is_error?(rc) 99: 100: return rc 101: end