Class: Fog::Compute::XenServer::Host

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/xenserver/models/compute/host.rb

Instance Method Summary collapse

Instance Method Details

#disableObject

Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.



116
117
118
# File 'lib/fog/xenserver/models/compute/host.rb', line 116

def disable
  service.disable_host(reference)
end

#enableObject

Puts the host into a state in which new VMs can be started.



125
126
127
# File 'lib/fog/xenserver/models/compute/host.rb', line 125

def enable
  service.enable_host(reference)
end

#host_cpusObject



77
78
79
80
81
82
83
84
85
# File 'lib/fog/xenserver/models/compute/host.rb', line 77

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

#metricsObject



87
88
89
90
91
# File 'lib/fog/xenserver/models/compute/host.rb', line 87

def metrics
  return nil unless __metrics
  rec = service.get_record(__metrics, 'host_metrics' )
  Fog::Compute::XenServer::HostMetrics.new(rec)
end

#pbdsObject



65
66
67
# File 'lib/fog/xenserver/models/compute/host.rb', line 65

def pbds
  __pbds.map { |pbd| service.pbds.get pbd }
end

#pifsObject



61
62
63
# File 'lib/fog/xenserver/models/compute/host.rb', line 61

def pifs
  __pifs.map { |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.

Parameters:

  • auto_disable (Boolean) (defaults to: true)

    disable the host first

See Also:



105
106
107
108
# File 'lib/fog/xenserver/models/compute/host.rb', line 105

def reboot(auto_disable = true)
  disable if auto_disable
  service.reboot_host(reference)
end

#resident_serversObject



69
70
71
# File 'lib/fog/xenserver/models/compute/host.rb', line 69

def resident_servers
  __resident_vms.map { |ref| service.servers.get ref }
end

#resident_vmsObject



73
74
75
# File 'lib/fog/xenserver/models/compute/host.rb', line 73

def resident_vms
  resident_servers
end

#set_attribute(name, *val) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/fog/xenserver/models/compute/host.rb', line 146

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.

Parameters:

  • auto_disable (Boolean) (defaults to: true)

    disable the host first

See Also:



141
142
143
144
# File 'lib/fog/xenserver/models/compute/host.rb', line 141

def shutdown(auto_disable = true)
  disable if auto_disable
  service.shutdown_host(reference)
end