Module netapp_ontap.resources.metrocluster_dr_group
Copyright © 2023 NetApp Inc. All rights reserved.
This file has been automatically generated based on the ONTAP REST API documentation.
Overview
You can use this API to create, perform operations, and retrieve relevant information pertaining to MetroCluster DR groups. The GET operation retrieves all the DR groups in the MetroCluster over IP configuration or a DR group information specified by the DR group id. The POST request can be used to create a new DR group in the MetroCluster over IP configuration. The DELETE operation removes a DR group information specified by the DR group id from the existing MetroCluster over IP configuration.
Creating a new DR group
A new DR group in MetroCluster over IP configuration is created by issuing a POST to /cluster/metrocluster/dr-groups. Parameters are provided in the body of the POST request. This operation requires a valid MetroCluster over IP configuration. The new nodes added belong to either the local or partner cluster.
Fields used for setting up a new DR group
The fields used for MetroCluster APIs are either required or optional and are described as follows:
Required configuration fields
These fields are always required for any POST /cluster/dr-groups request.
partner_cluster.name
- Specifies the partner cluster name to which cluster peering has been established.dr_pairs
- Specifies local and DR partner node pairs. Each pair uniquely identifies a DR group.
Optional configuration fields
This field is used to set up additional MetroCluster DR configuration.
mccip_ports
- Specifies relevant layer 3 network configuration information for each port. These include port name, node name, IP address, gateway, and netmask. If mccip_ports is not provided, then the API automatically generates IP addresses for the ports and creates an layer 2 network configuration.
Polling the create job
After a successful POST /cluster/metrocluster/dr-groups is issued, an HTTP status code of 202 (Accepted) is returned along with a job UUID and a link in the body of the response. The create job continues asynchronously and can be monitored by using the job UUID and the /cluster/jobs API. The "message" field in the response of the GET /cluster/jobs/{uuid} request shows the current step in the job, and the "state" field shows the overall state of the job.
Deleting a DR group using ID
A DR group in MetroCluster over IP configuration can be deleted by issuing a DELETE to /cluster/metrocluster/dr-groups/{id}. No parameters are required for the DELETE request. The following preparation steps must be completed on the local and partner clusters before removing a DR group.
- Move all the data volumes to another DR group.
- Move all the MDV_CRS metadata volumes to another DR group.
- Delete all the MDV_aud metadata volumes that may exist in the DR group to be removed.
- Delete all the data aggregates in the DR group to be removed. Root aggregates are not deleted.
- Migrate all the data LIFs to home nodes in another DR group.
- Migrate the cluster management LIF to a home node in another DR group. Node management and inter-cluster LIFs are not migrated.
- Transfer epsilon to a node in another DR group. The operation is refused if the preparation steps are not completed on the local and partner clusters.
Polling the delete job
After a successful DELETE /cluster/metrocluster/dr-groups is issued, an HTTP status code of 202 (Accepted) is returned along with a job UUID and a link in the body of the response. The delete job continues asynchronously and can be monitored by using the job UUID and the /cluster/jobs API. The "message" field in the response of the GET /cluster/jobs/{uuid} request shows the current step in the job, and the "state" field shows the overall state of the job.
Examples
Creating a DR group for MetroCluster over IP configuration
This example shows the POST body when creating a DR group for MetroCluster.
# API
/api/cluster/metrocluster/dr-groups
POST body included from file
from netapp_ontap import HostConnection
from netapp_ontap.resources import MetroclusterDrGroup
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = MetroclusterDrGroup()
resource.partner_cluster = {"name": "mcc_siteB"}
resource.dr_pairs = [{"node": {"name": "node-e"}, "partner": {"name": "node-g"}}]
resource.post(hydrate=True)
print(resource)
Inline POST body
from netapp_ontap import HostConnection
from netapp_ontap.resources import MetroclusterDrGroup
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = MetroclusterDrGroup()
resource.partner_cluster = {"name": "mcc_siteB"}
resource.dr_pairs = [{"node": {"name": "node-e"}, "partner": {"name": "node-g"}}]
resource.post(hydrate=True)
print(resource)
POST Response
HTTP/1.1 202 Accepted
Date: Fri, 18 Sep 2020 20:38:05 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Location: /api/cluster/metrocluster/dr-groups
Content-Length: 189
Content-Type: application/hal+json
{
"job": {
"uuid": "5b89472e-f9e8-11ea-9c31-005056bb42f7",
"_links": {
"self": {
"href": "/api/cluster/jobs/5b89472e-f9e8-11ea-9c31-005056bb42f7"
}
}
}
}
Monitoring the job progress
Use the link provided in the response to the POST request to fetch information for the DR group job.
Request
from netapp_ontap import HostConnection
from netapp_ontap.resources import Job
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = Job(uuid="5b89472e-f9e8-11ea-9c31-005056bb42f7")
resource.get()
print(resource)
Job status response
The following is an example of the job status response returned by the running DR group job:
HTTP/1.1 200 OK
Date: Fri, 18 Sep 2020 20:40:20 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 373
Content-Type: application/hal+json
{
"uuid": "5b89472e-f9e8-11ea-9c31-005056bb42f7",
"description": "POST /api/cluster/metrocluster/dr-groups/",
"state": "running",
"message": "Mirroring aggregates",
"code": 2432845,
"start_time": "2020-09-18T15:38:08-04:00",
"_links": {
"self": {
"href": "/api/cluster/jobs/5b89472e-f9e8-11ea-9c31-005056bb42f7"
}
}
}
Final status of a successful DR Group create workflow
When the create job completes, the 'end_time' field is populated, and the 'state' and 'message' fields report final status.
HTTP/1.1 200 OK
Date: Fri, 18 Sep 2020 20:43:54 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 373
Content-Type: application/hal+json
{
"uuid": "5b89472e-f9e8-11ea-9c31-005056bb42f7",
"description": "POST /api/cluster/metrocluster/dr-groups/",
"state": "success",
"message": "success",
"code": 0,
"start_time": "2020-09-18T15:51:35-04:00",
"end_time": "2020-09-18T16:10:17-04:00",
"_links": {
"self": {
"href": "/api/cluster/jobs/5b89472e-f9e8-11ea-9c31-005056bb42f7"
}
}
}
Retrieving the MetroCluster DR Groups configured in the MetroCluster over IP configuration
Request
from netapp_ontap import HostConnection
from netapp_ontap.resources import MetroclusterDrGroup
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
print(list(MetroclusterDrGroup.get_collection()))
Response
HTTP/1.1 200 OK
Date: Fri, 18 Sep 2020 20:47:05 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 849
Content-Type: application/hal+json
{
"records": [
{
"id": 1,
"_links": {
"self": {
"href": "/api/cluster/metrocluster/dr-groups/1"
}
}
},
{
"id": 2,
"_links": {
"self": {
"href": "/api/cluster/metrocluster/dr-groups/2"
}
}
}
],
"num_records": 2,
"_links": {
"self": {
"href": "/api/cluster/metrocluster/dr-groups"
}
}
}
Retrieving a Specific MetroCluster DR Group
Request
from netapp_ontap import HostConnection
from netapp_ontap.resources import MetroclusterDrGroup
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = MetroclusterDrGroup(id=2)
resource.get()
print(resource)
Response
HTTP/1.1 200 OK
Date: Fri, 18 Sep 2020 20:49:05 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 1049
Content-Type: application/hal+json
{
"id": 2,
"partner_cluster": {
"name": "mcc_siteB",
"uuid": "ea4d7114-f97f-11ea-a4bf-005056bb070a"
},
"dr_pairs": [
{
"node": {
"name": "node-e",
"uuid": "28f71e17-f988-11ea-b1dd-005056bb47e8"
},
"partner": {
"name": "node-g",
"uuid": "1af02867-f989-11ea-b86c-005056bbe97f"
}
},
{
"node": {
"name": "node-f",
"uuid": "b34ae3b8-f988-11ea-866b-005056bb0934"
},
"partner": {
"name": "node-h",
"uuid": "a21a2b16-f989-11ea-98d0-005056bb321d"
}
}
],
"_links": {
"self": {
"href": "/api/cluster/metrocluster/dr-groups/2"
}
}
}
Deleting a MetroCluster DR Group
Request
from netapp_ontap import HostConnection
from netapp_ontap.resources import MetroclusterDrGroup
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = MetroclusterDrGroup(id="{id}")
resource.delete()
Response
HTTP/1.1 200 OK
Date: Tue, 22 Sep 2020 03:29:01 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 189
Content-Type: application/hal+json
{
"job": {
"uuid": "c24d1083-fc83-11ea-acaf-005056bb47c1",
"_links": {
"self": {
"href": "/api/cluster/jobs/c24d1083-fc83-11ea-acaf-005056bb47c1"
}
}
}
}
Monitoring the job progress
Use the link provided in the response to the DELETE request to fetch information for the delete job.
Request
from netapp_ontap import HostConnection
from netapp_ontap.resources import Job
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = Job(uuid="c24d1083-fc83-11ea-acaf-005056bb47c1")
resource.get()
print(resource)
Job status response
The following is an example of the job status response returned by the MetroCluster DR Group delete job.
HTTP/1.1 200 OK
Date: Tue, 22 Sep 2020 03:30:01 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 374
Content-Type: application/hal+json
{
"uuid": "c24d1083-fc83-11ea-acaf-005056bb47c1",
"description": "DELETE /api/cluster/metrocluster/dr-groups/2",
"state": "running",
"message": "Unconfiguring Metrocluster DR Group",
"code": 2432859,
"start_time": "2020-09-21T23:29:01-04:00",
"_links": {
"self": {
"href": "/api/cluster/jobs/c24d1083-fc83-11ea-acaf-005056bb47c1"
}
}
}
Final Status of a successful MetroCluster DR Group delete workflow
When the delete job completes, the 'end_time' field is populated, and the 'state' and 'message' fields report the final status.
HTTP/1.1 200 OK
Date: Tue, 22 Sep 2020 03:38:08 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 374
Content-Type: application/hal+json
{
"uuid": "c24d1083-fc83-11ea-acaf-005056bb47c1",
"description": "DELETE /api/cluster/metrocluster/dr-groups/2",
"state": "success",
"message": "success",
"code": 0,
"start_time": "2020-09-21T23:29:01-04:00",
"end_time": "2020-09-21T23:36:36-04:00",
"_links": {
"self": {
"href": "/api/cluster/jobs/c24d1083-fc83-11ea-acaf-005056bb47c1"
}
}
}
Classes
class MetroclusterDrGroup (*args, **kwargs)
-
DR group 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 count_collection (*args, connection: HostConnection = None, **kwargs) -> int
-
Returns a count of all MetroclusterDrGroup resources that match the provided query
This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.
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 count 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. These query parameters can affect the count. A return_records query param will be ignored.
Returns
On success, returns an integer count of the objects of this type. On failure, returns -1.
Raises
NetAppRestError
: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library. def delete_collection (*args, records: Iterable[_ForwardRef('MetroclusterDrGroup')] = None, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse
-
Remove the DR group from the current MetroCluster over IP configuration specified by the DR group id.
Related ONTAP commands
metrocluster configuration-settings dr-group delete
Learn more
Delete all objects in a collection which match the given query.
All records on the host which match the query will be deleted.
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 delete the collection of bars for a particular foo, the foo.name value should be passed.
records
- Can be provided in place of a query. If so, this list of objects will be deleted from the host.
body
- The body of the delete request. This could be a Resource instance or a dictionary 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.
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 deleted.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400 def find (*args, connection: HostConnection = None, **kwargs) -> Resource
-
Retrieves all the DR group in the MetroCluster over IP configuration.
Related ONTAP commands
metrocluster configuration-settings dr-group show
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, None will be returned. 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 or None if no matches were found.Raises
NetAppRestError
: If the API call returned more than 1 matching resource. def get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]
-
Retrieves all the DR group in the MetroCluster over IP configuration.
Related ONTAP commands
metrocluster configuration-settings dr-group show
Learn more
Fetch a list of all objects of this type from the host.
This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.
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. This would be not be raised when get_collection() is called, but rather when the result is iterated. def post_collection (records: Iterable[_ForwardRef('MetroclusterDrGroup')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[MetroclusterDrGroup], NetAppResponse]
-
Creates a new DR group in the MetroCluster over IP configuration.
Required properties
partner_cluster.name
dr_pairs
Recommended optional properties
mccip_ports
Learn more
Related ONTAP commands
metrocluster configuration-settings dr-group create
Send this collection of objects to the host as a creation request.
Args
records
- A list of
Resource
objects to send to the server to be created. *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 create a bar for a particular foo, the foo.name value should be passed.
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 each object. When hydrate is set to True, poll must also be set to True.
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.
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 list of
Resource
objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then aNetAppResponse
object is returned instead.Raises
NetAppRestError
: If the API call returned a status code >= 400
Methods
def delete (self, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse
-
Remove the DR group from the current MetroCluster over IP configuration specified by the DR group id.
Related ONTAP commands
metrocluster configuration-settings dr-group delete
Learn more
Send a deletion request to the host for this object.
Args
body
- The body of the delete request. This could be a Resource instance or a dictionary 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.
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
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400 def get (self, **kwargs) -> NetAppResponse
-
Retrieves the DR group information specified by the DR group id.
Related ONTAP commands
metrocluster configuration-settings dr-group show
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 post (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse
-
Creates a new DR group in the MetroCluster over IP configuration.
Required properties
partner_cluster.name
dr_pairs
Recommended optional properties
mccip_ports
Learn more
Related ONTAP commands
metrocluster configuration-settings dr-group create
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.
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 normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.
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 MetroclusterDrGroupSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)
-
The fields of the MetroclusterDrGroup object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
-
dr_pairs: List[DrPair] GET POST PATCH
-
The dr_pairs field of the metrocluster_dr_group.
-
id: Size GET
-
DR Group ID
-
links: SelfLink GET
-
The links field of the metrocluster_dr_group.
-
mccip_ports: List[MetroclusterMccipPorts] POST
-
List of Port specifications.
-
partner_cluster: Cluster GET POST PATCH
-
The partner_cluster field of the metrocluster_dr_group.