Module netapp_ontap.resources.node
Copyright © 2019 NetApp Inc. All rights reserved.
Overview
This API is used to add nodes to a cluster, update node-specific configurations, and retrieve the current node configuration details.
Adding a node to a cluster
A node can be added to a cluster by issuing a POST /cluster/nodes request to a node currently in the cluster. All nodes must be at the same version to use this API. Mixed version joins are not supported in this release. Properties can be provided as fields in the body of the POST request to configure node-specific settings. On a successful request, POST /cluster/nodes returns a status code of 202 and job information in the body. The /cluster/jobs APIs can be used to track the status of the node add job.
Fields used for adding a node
Fields used for the /cluster/nodes APIs fall into the following categories
Required node fields
The following field is required for any POST /cluster/nodes request:
- cluster_interface.ip.address
Optional fields
All of the following fields are used to setup additional cluster-wide configuration:
- name
- location
- records
Network interface fields
Each node can have a node-specific configuration set in POST /cluster/nodes. If a field is provided in the body of a node, it must be provided for all nodes in the POST body.
The node management interface can be provided for each node if all node management interfaces in the cluster use the same netmask. If the node management interfaces use different netmasks, then configuration of the node management interfaces should be done using the /network/ip/interfaces API.
The records field
Multiple nodes can be added to the cluster in one request by providing an array named "records" with multiple node entries. Each node entry in records must follow the required and optional fields listed previously. When only adding a single node, no records field is needed. See 'Example usecases' for an example of how to use the records field.
Modifying node configurations
The following fields can be used to modify a node configuration:
- name
- location
Examples
The following examples show how to shutdown/reboot a node and how to update a node configuration.
Adding a single node with a minimal configuration
# Body
body =
{
"cluster_interface": {
"ip": {
"address": "1.1.1.1"
}
}
}
# Request
curl -X POST "https://<mgmt-ip>/api/cluster/nodes" -d body
Adding multiple nodes in the same request
# Body
body =
{
"records": [
{
"name": "node1",
"cluster_interface": {
"ip": {
"address": "1.1.1.1"
}
}
},
{
"name": "node2",
"cluster_interface": {
"ip": {
"address": "2.2.2.2"
}
}
},
]
}
# Request
curl -X POST "https://<mgmt-ip>/api/cluster/nodes" -d body
Modifying a cluster-wide configuration
# Body
body =
{
"name": "renamedNode",
"location": "newLocation"
}
# Request
curl -X PATCH "https://<mgmt-ip>/api/cluster/nodes" -d body
Shutting down a node
curl -X PATCH "https://<mgmt-ip>/api/cluster/nodes/{uuid}?action=shutdown"
Classes
class Node (*args, **kwargs)
-
Complete node information
Initialize the instance of the resource.
Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:
MyResource(name='foo').name == 'foo'
Args
*args
- Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
- each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.
Ancestors
Static methods
def find(*args, connection: HostConnection = None, **kwargs) -> Resource
-
Retrieves the nodes in the cluster.
Learn more
Find an instance of an object on the host given a query.
The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found or if more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.
Args
*args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. **kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A
Resource
object containing the details of the object.Raises
NetAppRestError
: If the API call did not return exactly 1 matching resource. def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable
-
Retrieves the nodes in the cluster.
Learn more
Fetch a list of all objects of this type from the host.
Args
*args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. max_records
- The maximum number of records to return per call
**kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A list of
Resource
objectsRaises
NetAppRestError
: If there is no connection available to use either passed in or on the library. def patch_collection(body: dict, *args, connection: HostConnection = None, **kwargs) -> NetAppResponse
-
Updates the node information or performs shutdown/reboot actions on a node.
Learn more
Patch all objects in a collection which match the given query.
All records on the host which match the query will be patched with the provided body.
Args
body
- A dictionary of name/value pairs to set on all matching members of the collection.
*args
- Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to patch the collection of bars for a particular foo, the foo.name value should be passed.
connection
- The
HostConnection
object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context. **kwargs
- Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400
Methods
def get(self, **kwargs) -> NetAppResponse
-
Retrieves information for the node.
Learn more
Fetch the details of the object from the host.
Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400 def patch(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse
-
Updates the node information or performs shutdown/reboot actions on a node.
Learn more
Send the difference in the object's state to the host as a modification request.
Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.
Args
hydrate
- If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
- If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
- If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
- If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
**kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400 def post(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse
-
Adds a node or nodes to the cluster
Required properties
cluster_interface.ip.address
Learn more
Send this object to the host as a creation request.
Args
hydrate
- If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
- If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
- If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
- If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
**kwargs
- Any key/value pairs passed will be sent as query parameters to the host.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400
Inherited members
class NodeSchema (only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
-
The fields of the Node object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.schema.BaseSchema
- marshmallow.base.SchemaABC
Class variables
var cluster_interface
-
The cluster_interface field of the node.
var cluster_interfaces
-
The cluster_interfaces field of the node.
var controller
-
The controller field of the node.
var date_
-
Specifies the ISO-8601 format date and time on the node.
Example: 2017-01-25T07:20:13.000+0000
var ha
-
The ha field of the node.
var links
-
The links field of the node.
var location
-
The location field of the node.
Example: rack 2 row 5
var management_interface
-
The management_interface field of the node.
var management_interfaces
-
The management_interfaces field of the node.
var membership
-
Possible values:
- available - If a node is available, this means it is detected on the internal cluster network and can be added to the cluster. Nodes that have a membership of "available" are not returned when a GET request is called when the cluster exists. A query on the "membership" property for available must be provided to scan for nodes on the cluster network. Nodes that have a membership of "available" are returned automatically before a cluster is created.
- joining - Joining nodes are in the process of being added to the cluster. The node may be progressing through the steps to become a member or might have failed. The job to add the node or create the cluster provides details on the current progress of the node.
- member - Nodes that are members have successfully joined the cluster.
Valid choices:
- available
- joining
- member
var model
-
The model field of the node.
Example: FAS3070
var name
-
The name field of the node.
Example: node-01
var opts
var serial_number
-
The serial_number field of the node.
Example: 4048820-60-9
var service_processor
-
The service_processor field of the node.
var uptime
-
The total time, in seconds, that the node has been up.
Example: 300536
var uuid
-
The uuid field of the node.
Example: 4ea7a442-86d1-11e0-ae1c-123478563412
var version
-
The version field of the node.