
Methods
public class
public instance
Constants
HOST_METHODS | = | { :info => "host.info", :allocate => "host.allocate", :delete => "host.delete", :enable => "host.enable" } | Constants and Class Methods | |
HOST_STATES | = | %w{INIT MONITORING MONITORED ERROR DISABLED} | ||
SHORT_HOST_STATES | = | { "INIT" => "on", "MONITORING" => "on", "MONITORED" => "on", "ERROR" => "err", "DISABLED" => "off" } |
Public class methods
Creates a Host description with just its identifier this method should be used to create plain Host objects. id the id of the host
Example:
host = Host.new(Host.build_xml(3),rpc_client)
# File OpenNebula/Host.rb, line 48 48: def Host.build_xml(pe_id=nil) 49: if pe_id 50: host_xml = "<HOST><ID>#{pe_id}</ID></HOST>" 51: else 52: host_xml = "<HOST></HOST>" 53: end 54: 55: XMLElement.build_xml(host_xml, 'HOST') 56: end
Class constructor
# File OpenNebula/Host.rb, line 61 61: def initialize(xml, client) 62: super(xml,client) 63: 64: @client = client 65: @pe_id = self['ID'].to_i if self['ID'] 66: end
Public instance methods
Allocates a new Host in OpenNebula
hostname A string containing the name of the new Host.
im A string containing the name of the im_driver
vmm A string containing the name of the vmm_driver
tm A string containing the name of the tm_driver
# File OpenNebula/Host.rb, line 86 86: def allocate(hostname,im,vmm,tm) 87: super(HOST_METHODS[:allocate],hostname,im,vmm,tm) 88: end
Returns the cluster of the Host
# File OpenNebula/Host.rb, line 125 125: def cluster 126: self['CLUSTER'] 127: end
Deletes the Host
# File OpenNebula/Host.rb, line 91 91: def delete() 92: super(HOST_METHODS[:delete]) 93: end
Disables the Host
# File OpenNebula/Host.rb, line 101 101: def disable() 102: set_enabled(false) 103: end
Enables the Host
# File OpenNebula/Host.rb, line 96 96: def enable() 97: set_enabled(true) 98: end
Retrieves the information of the given Host.
# File OpenNebula/Host.rb, line 73 73: def info() 74: super(HOST_METHODS[:info], 'HOST') 75: end
Returns the state of the Host (string value)
# File OpenNebula/Host.rb, line 120 120: def short_state_str 121: SHORT_HOST_STATES[state_str] 122: end
Returns the state of the Host (numeric value)
# File OpenNebula/Host.rb, line 110 110: def state 111: self['STATE'].to_i 112: end
Returns the state of the Host (string value)
# File OpenNebula/Host.rb, line 115 115: def state_str 116: HOST_STATES[state] 117: end