Module: Rubineti::Node

Defined in:
lib/rubineti/compute/node.rb

Instance Method Summary collapse

Instance Method Details

#node_evacuate(node_name, params = {}) ⇒ Object

Evacuates all secondary instances off a node.

To evacuate a node, either one of the iallocator or remote_node parameters must be passed:

- evacuate?iallocator=[iallocator]
- evacuate?remote_node=[nodeX.example.com]

See: docs.ganeti.org/ganeti/2.2/html/rapi.html#nodes-node-name-evacuate

If the optional dry-run parameter (?dry-run=1) is provided, the job will not be actually executed, only the pre-execution checks will be done.



16
17
18
19
# File 'lib/rubineti/compute/node.rb', line 16

def node_evacuate node_name, params = {}
  warn "WARNING: Node#node_evacuate not implemented."
  # post "/2/nodes/#{node_name}/evacuate", params
end

#node_list(node_name) ⇒ Object

Returns information about a node.



24
25
26
# File 'lib/rubineti/compute/node.rb', line 24

def node_list node_name
  get "/2/nodes/#{node_name}"
end

#node_migrate(node_name, params = {}) ⇒ Object

Migrates all primary instances from a node.

If no mode is explicitly specified, each instances’ hypervisor default migration mode will be used. Query parameters:

- live (bool): If set, use live migration if available.
- mode (string): Sets migration mode, live for live migration
  and non-live for non-live migration. Supported by Ganeti 2.2 and above.


37
38
39
40
# File 'lib/rubineti/compute/node.rb', line 37

def node_migrate node_name, params = {}
  warn "WARNING: Node#node_migrate not implemented."
  # post "/2/nodes/#{node_name}/migrate", params
end

#node_role_create(node_name) ⇒ Object

Change the node role. Returns a job id.

It supports the bool force argument.



48
49
50
51
52
# File 'lib/rubineti/compute/node.rb', line 48

def node_role_create node_name
  warn "WARNING: Node#node_role_create not implemented."
  # TODO: API Docs do not describe it's usage well.
  # put "/2/nodes/#{node_name}/role"
end

#node_role_list(node_name) ⇒ Object

Returns the current node role.



57
58
59
# File 'lib/rubineti/compute/node.rb', line 57

def node_role_list node_name
  get "/2/nodes/#{node_name}/role"
end

#node_storage_list(node_name, params = {}) ⇒ Object

Requests a list of storage units on a node. Returns a job id.

Requires the parameters storage_type (one of file, lvm-pv or lvm-vg) and output_fields.



77
78
79
80
# File 'lib/rubineti/compute/node.rb', line 77

def node_storage_list node_name, params = {}
  warn "WARNING: Node#node_storage_list not implemented."
  # get "/2/nodes/#{node_name}/storage", params
end

#node_storage_modify(node_name, params = {}) ⇒ Object

Modifies storage units on the node. Returns a job id.

Requires the parameters storage_type (one of file, lvm-pv or lvm-vg) and name (name of the storage unit). Parameters can be passed additionally. Currently only allocatable (bool) is supported.



89
90
91
92
# File 'lib/rubineti/compute/node.rb', line 89

def node_storage_modify node_name, params = {}
  warn "WARNING: Node#node_storage_modify not implemented."
  # put "/2/nodes/#{node_name}/storage/modify", params
end

#node_storage_repair(node_name, params = {}) ⇒ Object

Repairs a storage unit on the node. Returns a job id.

Requires the parameters storage_type (currently only lvm-vg can be repaired) and name (name of the storage unit).



101
102
103
104
# File 'lib/rubineti/compute/node.rb', line 101

def node_storage_repair node_name, params = {}
  warn "WARNING: Node#node_storage_repair not implemented."
  # put "/2/nodes/#{node_name}/repair", params
end

#node_tags_create(node_name, params = {}) ⇒ Object

Add a set of tags. Returns a job id.

If the optional dry-run parameter (?dry-run=1) is provided, the job will not be actually executed, only the pre-execution checks will be done.



114
115
116
117
# File 'lib/rubineti/compute/node.rb', line 114

def node_tags_create node_name, params = {}
  warn "WARNING: Node#node_tags_create not implemented."
  # put "/2/nodes/#{node_name}/tags", params
end

#node_tags_delete(node_name, params = {}) ⇒ Object

Deletes tags. Returns a job id.

If the optional dry-run parameter (?dry-run=1) is provided, the job will not be actually executed, only the pre-execution checks will be done.



127
128
129
130
# File 'lib/rubineti/compute/node.rb', line 127

def node_tags_delete node_name, params = {}
  warn "WARNING: Node#node_tags_delete not implemented."
  # delete "/2/nodes/#{node_name}/tags", params
end

#node_tags_list(node_name) ⇒ Object

Return a list of tags.



135
136
137
138
# File 'lib/rubineti/compute/node.rb', line 135

def node_tags_list node_name
  warn "WARNING: Node#node_tags_list not implemented."
  # get "/2/nodes/#{node_name}/tags"
end

#nodes_list(params = {}) ⇒ Object

Returns a list of all nodes.

If the optional bulk parameter (?bulk=1) is provided, the output contains detailed information about instances as a list.



67
68
69
# File 'lib/rubineti/compute/node.rb', line 67

def nodes_list params = {}
  get "/2/nodes", params
end