Class: Pangea::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/pangea/cluster.rb

Overview

A Xen Cluster is a group of Hosts

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Cluster

:nodoc:



7
8
9
10
11
# File 'lib/pangea/cluster.rb', line 7

def initialize(config={})
  @index = {}
  @config = config 
  @nodes = []
end

Instance Method Details

#[](name) ⇒ Object



13
14
15
16
17
# File 'lib/pangea/cluster.rb', line 13

def [](name)
  # initialize the node list
  nodes if @index.empty?
  @index[name]
end

#hostsObject

Deprecated, use Cluster.nodes



20
21
22
23
# File 'lib/pangea/cluster.rb', line 20

def hosts
  puts "WARNING: Cluster.hosts is deprecated. Use Cluster.nodes instead"
  nodes
end

#nodesObject

Returns the list of nodes in the Cluster



28
29
30
31
32
# File 'lib/pangea/cluster.rb', line 28

def nodes
  return @nodes if (not @nodes.nil? and @nodes.size > 0)
  init_nodes
  @nodes
end