Class: Command::ClusterCreate

Inherits:
CrowbarNodeCommand show all
Defined in:
lib/command/cluster_create.rb

Overview

Allows to create a cluster

Instance Attribute Summary collapse

Attributes inherited from BasicCommand

#logger, #receiver

Instance Method Summary collapse

Constructor Details

#initialize(cluster_name, network_address, network_mask, cpu_weight = nil, ram = nil, vlan_id = nil, description = nil) ⇒ ClusterCreate

Default constructor.

Parameters:

  • cluster_name (String)

    The cluster name.

  • network_address (String)

    The network address.

  • network_mask (String)

    The network mask.

  • cpu_weight (Integer) (defaults to: nil)

    The CPU weight.

  • ram (String) (defaults to: nil)

    The ram to allocate.

  • vlan_id (Integer) (defaults to: nil)

    The VLAN id.

  • description (String) (defaults to: nil)

    The cluster description.

Author:

  • mbretaud



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/command/cluster_create.rb', line 28

def initialize(cluster_name, network_address, network_mask, cpu_weight = nil, ram = nil, vlan_id = nil, description = nil)
  super()
  @logger.info("Command::ClusterCreate   initialize the parameters...")
  @cluster_name = cluster_name
  @network_address = network_address
  @cpu_weight = cpu_weight
  @ram = ram
  @description = description
  @vlan_id = vlan_id
  @mask = network_mask
end

Instance Attribute Details

#cluster_nameObject (readonly)

Returns the value of attribute cluster_name.



10
11
12
# File 'lib/command/cluster_create.rb', line 10

def cluster_name
  @cluster_name
end

#cpu_weightObject (readonly)

Returns the value of attribute cpu_weight.



13
14
15
# File 'lib/command/cluster_create.rb', line 13

def cpu_weight
  @cpu_weight
end

#descriptionObject (readonly)

Returns the value of attribute description.



15
16
17
# File 'lib/command/cluster_create.rb', line 15

def description
  @description
end

#maskObject (readonly)

Returns the value of attribute mask.



12
13
14
# File 'lib/command/cluster_create.rb', line 12

def mask
  @mask
end

#network_addressObject (readonly)

Returns the value of attribute network_address.



11
12
13
# File 'lib/command/cluster_create.rb', line 11

def network_address
  @network_address
end

#ramObject (readonly)

Returns the value of attribute ram.



14
15
16
# File 'lib/command/cluster_create.rb', line 14

def ram
  @ram
end

#vlan_idObject (readonly)

Returns the value of attribute vlan_id.



16
17
18
# File 'lib/command/cluster_create.rb', line 16

def vlan_id
  @vlan_id
end

Instance Method Details

#execObject

The method allow to create cluster

Author:

  • mbretaud



42
43
44
45
46
47
48
# File 'lib/command/cluster_create.rb', line 42

def exec()
  output = ""

  output += @receiver.crowbar_create_cluster(@cluster_name, @network_address, @mask, @cpu_weight, @ram, @vlan_id, @description)

  return output
end