Class: Fog::Compute::XenServer::Host
- Defined in:
- lib/fog/xenserver/models/compute/host.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#disable ⇒ Object
Puts the host into a state in which no new VMs can be started.
-
#enable ⇒ Object
Puts the host into a state in which new VMs can be started.
- #host_cpus ⇒ Object
- #metrics ⇒ Object
- #pbds ⇒ Object
- #pifs ⇒ Object
-
#reboot(auto_disable = true) ⇒ Object
Reboot the host disabling it first unless auto_disable is set to false.
- #resident_servers ⇒ Object
- #resident_vms ⇒ Object
- #set_attribute(name, *val) ⇒ Object
-
#shutdown(auto_disable = true) ⇒ Object
Shutdown the host disabling it first unless auto_disable is set to false.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#disable ⇒ Object
Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.
84 85 86 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 84 def disable service.disable_host(reference) end |
#enable ⇒ Object
Puts the host into a state in which new VMs can be started.
93 94 95 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 93 def enable service.enable_host(reference) end |
#host_cpus ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 45 def host_cpus cpus = [] (__host_cpus || []).each do |ref| cpu_ref = service.get_record(ref, 'host_cpu' ) cpu_ref[:service] = service cpus << Fog::Compute::XenServer::HostCpu.new(cpu_ref) end cpus end |
#metrics ⇒ Object
55 56 57 58 59 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 55 def metrics return nil unless __metrics rec = service.get_record(__metrics, 'host_metrics' ) Fog::Compute::XenServer::HostMetrics.new(rec) end |
#pbds ⇒ Object
33 34 35 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 33 def pbds __pbds.collect { |pbd| service.pbds.get pbd } end |
#pifs ⇒ Object
29 30 31 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 29 def pifs __pifs.collect { |pif| service.pifs.get pif } end |
#reboot(auto_disable = true) ⇒ Object
Reboot the host disabling it first unless auto_disable is set to false
This function can only be called if there are no currently running VMs on the host and it is disabled. If there are running VMs, it will raise an exception.
73 74 75 76 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 73 def reboot(auto_disable = true) disable if auto_disable service.reboot_host(reference) end |
#resident_servers ⇒ Object
37 38 39 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 37 def resident_servers __resident_vms.collect { |ref| service.servers.get ref } end |
#resident_vms ⇒ Object
41 42 43 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 41 def resident_vms resident_servers end |
#set_attribute(name, *val) ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 114 def set_attribute(name, *val) data = service.set_attribute( 'host', reference, name, *val ) # Do not reload automatically for performance reasons # We can set multiple attributes at the same time and # then reload manually #reload end |
#shutdown(auto_disable = true) ⇒ Object
Shutdown the host disabling it first unless auto_disable is set to false.
This function can only be called if there are no currently running VMs on the host and it is disabled. If there are running VMs, it will raise an exception.
109 110 111 112 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 109 def shutdown(auto_disable = true) disable if auto_disable service.shutdown_host(reference) end |