Nodes¶
While most ways to interact with a cluster are available via the
lavaclient.api.clusters
methods, you can interact with cluster nodes
directly using the lavaclient.api.nodes
methods. For example:
>>> nodes = lava.nodes.list('fd8cbe7e-04e2-4329-b80e-26edb8fa39bb')
>>> nodes
[Node(id='58329654-09f5-45c2-86bc-a5469836c38d', name='master-1', flavor_id, addresses, components, created, node_group, private_ip, public_ip, status, updated),
Node(id='7595cdb7-5cb9-4cde-b033-84709998a6e0', name='secondary-1', flavor_id, addresses, components, created, node_group, private_ip, public_ip, status, updated),
Node(id='9831887a-88d6-4e35-9046-4c5ce0765b29', name='gateway-1', flavor_id, addresses, components, created, node_group, private_ip, public_ip, status, updated),
Node(id='b32e94eb-ba88-43ef-a833-27824446b48e', name='slave-1', flavor_id, addresses, components, created, node_group, private_ip, public_ip, status, updated)]
# Execute command over ssh
>>> nodes[0].execute('scott', 'pwd',
... ssh_command='ssh -o StrictHostKeyChecking=no')
'/home/scott'
API Reference¶
-
class
lavaclient.api.nodes.
Resource
¶ Nodes API methods
-
delete
(cluster_id, node_id)¶ Delete the node with node_id belonging to the cluster
Parameters: - cluster_id –
- node_id –
Returns: None
-
-
class
lavaclient.api.response.
Node
¶ -
describe
()¶ Return a pretty-formatted string that describes the format of the data
-
execute
(username, command, ssh_command=None)¶ Execute a command remotely on this node, returning the output.
Parameters: - username – Login user
- command – Command to execute remotely
- ssh_command – ssh command string or list, e.g. ssh -F configfile
Returns: Output from running command
-
to_dict
()¶ Convert the config to a plain python dictionary
-
components
¶ Components installed on this node, e.g. HiveClient
-
flavor_id
¶
-
id
¶
-
name
¶
-
node_group
¶ Node group ID
-
private_ip
¶ Private IP address on service network
-
public_ip
¶ Public IP address
-
status
¶
-