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

list(cluster_id)

List nodes belonging to the cluster.

Returns:List of Node objects
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

addresses

Public and private IP addresses; See: Addresses

components

Components installed on this node, e.g. HiveClient

created

datetime corresponding to creation date

flavor_id
id
name
node_group

Node group ID

private_ip

Private IP address on service network

public_ip

Public IP address

status
updated

datetime corresponding to date last updated

class lavaclient.api.response.Addresses
describe()

Return a pretty-formatted string that describes the format of the data

to_dict()

Convert the config to a plain python dictionary

private

See: Address

public

See: Address

class lavaclient.api.response.Address
describe()

Return a pretty-formatted string that describes the format of the data

to_dict()

Convert the config to a plain python dictionary

address
version