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.
117 118 119 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 117 def disable service.disable_host(reference) end |
#enable ⇒ Object
Puts the host into a state in which new VMs can be started.
126 127 128 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 126 def enable service.enable_host(reference) end |
#host_cpus ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 78 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
88 89 90 91 92 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 88 def metrics return nil unless __metrics rec = service.get_record(__metrics, 'host_metrics' ) Fog::Compute::XenServer::HostMetrics.new(rec) end |
#pbds ⇒ Object
66 67 68 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 66 def pbds __pbds.collect { |pbd| service.pbds.get pbd } end |
#pifs ⇒ Object
62 63 64 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 62 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.
106 107 108 109 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 106 def reboot(auto_disable = true) disable if auto_disable service.reboot_host(reference) end |
#resident_servers ⇒ Object
70 71 72 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 70 def resident_servers __resident_vms.collect { |ref| service.servers.get ref } end |
#resident_vms ⇒ Object
74 75 76 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 74 def resident_vms resident_servers end |
#set_attribute(name, *val) ⇒ Object
147 148 149 150 151 152 153 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 147 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.
142 143 144 145 |
# File 'lib/fog/xenserver/models/compute/host.rb', line 142 def shutdown(auto_disable = true) disable if auto_disable service.shutdown_host(reference) end |