Parent

Pangea::Host

A Physical Host

xen-api: Class host

require ‘pangea’

host = Host.connect('http://xen.example.net’, ‘username’, ‘password’)

Public Class Methods

connect(url, username, password) click to toggle source

Connect to the Host xml-rpc server

Returns a Pangea::Host object

There’s no direct mapping to xen-api

# File lib/pangea/objects.rb, line 198
    def self.connect(url, username, password)
      @link = Link.new(url, username, password)
      @link.connect
      @ref = @link.client.call('host.get_all', @link.sid)['Value'][0]
      Host.new(@link, @ref)
    end

Public Instance Methods

alive?() click to toggle source

Checks if the connection to the host xml-rpc server is alive

There’s no direct mapping to xen-api

# File lib/pangea/objects.rb, line 221
    def alive?
      begin
        ref_call :get_uuid
      rescue Exception => e
        puts e.message
        return false
      end
      true
    end
cpus() click to toggle source

Get the list of resident virtual machines controlled by the hypervisor.

Returns an Array of Pangea::HostCpu objects

xen-api: host.get_host_cpus

# File lib/pangea/objects.rb, line 120
    def cpus
      list = []
      ref_call(:get_host_CPUs).each do |hcpu|
        list << HostCpu.new(@link, hcpu)
      end
      list
    end
label() click to toggle source

Returns the label of the Host (hostname)

# File lib/pangea/objects.rb, line 92
    def label
      ref_call :get_name_label
    end
metrics() click to toggle source

Get the Pangea::HostMetrics object for this host

xen-api: host.get_metrics

# File lib/pangea/objects.rb, line 161
    def metrics
      HostMetrics.new(@link, ref_call(:get_metrics))
    end
networks() click to toggle source

Returns the list of networks available in this host

If you are using a bridged network configuration (‘network-script network-bridge’ in xend-config.sxp), it will return an Array of Pangea::Network objects available in the host, one for each bridge available.

There’s no direct mapping to xen-api AFAIK

# File lib/pangea/objects.rb, line 175
    def networks
      nets = [] 
      p = @link.client.proxy( 'network' )
      p.get_all(@link.sid)['Value'].each do |ref|
        nets << Network.new(@link, ref)
      end
      nets
    end
reconnect() click to toggle source

Reconnect to the Host

There’s no direct mapping to xen-api

# File lib/pangea/objects.rb, line 210
    def reconnect
      raise LinkConnectError.new("You need to connect at least once before reconnecting") if @link.nil?
      @link.connect
      @ref = @link.client.call('host.get_all', @link.sid)['Value'][0]
    end
resident_vms() click to toggle source

Get the list of resident virtual machines controlled by the hypervisor.

Returns an Array of Pangea::VM objects

xen-api: host.get_resident_VMs

# File lib/pangea/objects.rb, line 104
    def resident_vms
      vms = []
      ref_call(:get_resident_VMs).each do |vm|
        vms << VM.new(@link, vm)
      end
      vms
    end
sched_policy() click to toggle source

Get the Xen scheduling policy

Returns a string

xen-api: host.get_sched_policy

# File lib/pangea/objects.rb, line 152
    def sched_policy
      ref_call :get_sched_policy
    end
software_version() click to toggle source

List some properties from the hypervisor:

machine: Host Architecture Xen: Xen Version system: Host OS (i.e. Linux) release: Xen Kernel Version host: hostname

Returns a Hash

xen-api: host.get_software_version

# File lib/pangea/objects.rb, line 141
    def software_version
      ref_call :get_software_version
    end
to_s() click to toggle source

(Not documented)

# File lib/pangea/objects.rb, line 184
    def to_s
      "Label: #{label}\n" +
      "UUID: #{uuid}\n" +
      "Sched Policy: #{sched_policy}\n" +
      "Xen Version: #{software_version['Xen']}"
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.