Skip to main content
A newer release of this product is available.

Create a SnapMirror policy

Contributors

POST /snapmirror/policies

Introduced In: 9.6

Creates a SnapMirror policy. The property "identity_preservation" is applicable to only SnapMirror relationships with SVM endpoints and it indicates which configuration of the source SVM is replicated to the destination SVM.

It takes the following values:

  • full - indicates that the source SVM configuration is replicated to the destination SVM endpoint.

  • exclude_network_config - indicates that the source SVM configuration other than network configuration is replicated to the destination SVM endpoint.

  • exclude_network_and_protocol_config - indicates that the source SVM configuration is not replicated to the destination SVM endpoint.

Important notes

  • The property "identity_preservation" is applicable to only SnapMirror relationships with SVM endpoints and it indicates which configuration of the source SVM is replicated to the destination SVM.

  • The properties "identity_preservation" and "transfer_schedule" are not applicable for "sync" type policies.

  • The properties "copy_all_source_snapshots", "copy_latest_source_snapshot", and "create_snapshot_on_source" are mutually exclusive.

  • The properties "copy_all_source_snapshots", "copy_latest_source_snapshot", and "create_snapshot_on_source" are not applicable for "sync" type policies.

  • No "retention" properties can be specified if "copy_all_source_snapshots" or 'copy_latest_source_snapshot' is specified.

  • The properties "retention.creation_schedule" and "retention.prefix" are not applicable for "sync" type policies.

  • The property "retention.creation_schedule" is not applicable for "async" policies with "create_snapshot_on_source" set to "false".

  • The property "sync_common_snapshot_schedule" is not applicable for an "async" type policy.

  • The property "retention.count" specifies the maximum number of Snapshot copies that are retained on the SnapMirror destination volume.

  • When the property "retention.label" is specified, the Snapshot copies that have a SnapMirror label matching this property is transferred to the SnapMirror destination.

  • When the property "retention.creation_schedule" is specified, Snapshot copies are directly created on the SnapMirror destination. The Snapshot copies created have the same content as the latest Snapshot copy already present on the SnapMirror destination.

  • The property "transfer_schedule" cannot be set to null (no-quotes) during SnapMirror policy POST.

  • The properties "retention.label" and "retention.count" must be specified for "async" policies with "create_snapshot_on_source" set to "false".

  • The property "rentention.warn" is not supported for a policy when the "retention.preserve" property is false.

  • The property "retention.warn" value must be less than the property "retention.count" value for a rule in a policy.

Required properties

  • name - Name of the new SnapMirror policy.

  • svm.name or svm.uuid - Name or UUID of the SVM that owns the SnapMirror policy.

Default property values

If not specified in POST, the following default property values are assigned:

  • type - async

  • sync_type - sync (when type is sync)

  • network_compression_enabled - false

  • throttle - 0

  • identity_preservation - exclude_network_and_protocol_config

  • snapmirror policy create

Examples

Creating a SnapMirror policy of type "sync"

 POST "/api/snapmirror/policies/" '{"name": "policy1", "svm.name": "VS0", "type": "sync", "sync_type": "sync"}'

Creating a SnapMirror policy of type "async" with two sets of retention values, one with a creation_schedule

 POST "/api/snapmirror/policies" '{"name": "policy_ret", "svm": {"name": "vs1"}, "retention": [{"label": "weekly", "count": "2", "creation_schedule": {"name": "weekly"}}, {"label":"daily", "count":"7"}]}'

Creating a SnapMirror policy of type "async"

 POST "/api/snapmirror/policies" '{"name": "newPolicy", "svm":{"name" : "vs1"}, "type": "async"}'

Creating a SnapMirror policy of type "async" which replicates all Snapshot copies

 POST "/api/snapmirror/policies" '{"name": "newPolicy", "svm":{"name" : "vs1"}, "type": "async", "copy_all_source_snapshots": "true"}'

Creating a SnapMirror policy of type "async" which replicates latest Snapshot copy

 POST "/api/snapmirror/policies" '{"name": "newPolicy2", "svm":{"name" : "vs1"}, "type": "async", "copy_latest_source_snapshot": "true"}'

Creating a SnapMirror policy of type "async" which does not create Snapshot copies on source

 POST "/api/snapmirror/policies" '{"name": "newPolicy", "svm":{"name" : "vs1"}, "type": "async", "create_snapshot_on_source": "false", "retention": [{"label": "daily", "count": 7}]}'

Creating a SnapMirror policy of type "sync" with sync_type as "automated_failover"

 POST "/api/snapmirror/policies/" '{"name": "policy1", "svm.name": "VS0", "type": "sync", "sync_type": "automated_failover" }'

Creating a SnapMirror policy of type "async" with two sets of retention values and retention periods

 POST "/api/snapmirror/policies" '{"name": "policy_ret", "svm": {"name": "vs1"}, "retention": [{"label": "weekly", "count": "2", "period": "P7D"}, {"label":"daily", "count":"7", "period": "PT3H"}]}'

Creating a SnapMirror policy of type "async" with retention value as "infinite"

 POST "/api/snapmirror/policies" '{"name": "policy_ret", "svm": {"name": "vs1"}, "retention": [{"label": "weekly", "count": "5", "period": "infinite"}]}'

Creating a SnapMirror policy of type "async" with properties retention preserve as true and retention warn as 3.

 POST "/api/snapmirror/policies" '{"name": "policy_ret", "svm": {"name": "vs1"}, "retention": [{"label": "weekly", "count": "5", "preserve": true, "warn": 3}]}'

Parameters

Name Type In Required Description

return_records

boolean

query

False

The default is false. If set to true, the records are returned.

  • Default value:

return_timeout

integer

query

False

The number of seconds to allow the call to execute before returning. When doing a POST, PATCH, or DELETE operation on a single record, the default is 0 seconds. This means that if an asynchronous operation is started, the server immediately returns HTTP code 202 (Accepted) along with a link to the job. If a non-zero value is specified for POST, PATCH, or DELETE operations, ONTAP waits that length of time to see if the job completes so it can return something other than 202.

  • Default value: 1

  • Max value: 120

  • Min value: 0

Request Body

Name Type Description

_links

_links

comment

string

Comment associated with the policy.

copy_all_source_snapshots

boolean

Specifies that all the source Snapshot copies (including the one created by SnapMirror before the transfer begins) should be copied to the destination on a transfer. "Retention" properties cannot be specified along with this property. This is applicable only to async policies. Property can only be set to 'true'.

copy_latest_source_snapshot

boolean

Specifies that the latest source Snapshot copy (created by SnapMirror before the transfer begins) should be copied to the destination on a transfer. "Retention" properties cannot be specified along with this property. This is applicable only to async policies. Property can only be set to 'true'.

create_snapshot_on_source

boolean

Specifies whether a new Snapshot copy should be created on the source at the beginning of an update or resync operation. This is applicable only to async policies. Property can only be set to 'false'.

identity_preservation

string

Specifies which configuration of the source SVM is replicated to the destination SVM. This property is applicable only for SVM data protection with "async" policy type.

name

string

Name of the policy.

network_compression_enabled

boolean

Specifies whether network compression is enabled for transfers. This is applicable only to the policies of type "async".

retention

array[snapmirror_policy_rule]

Rules for Snapshot copy retention.

rpo

integer

Specifies the duration of time for which a change to be propagated to a mirror should be delayed, in seconds. This is an intentional propagation delay between mirrors and is configurable down to zero, which means an immediate propagation. This is supported for policies of type 'continuous'.

scope

string

Set to "svm" for policies owned by an SVM, otherwise set to "cluster".

svm

svm

sync_common_snapshot_schedule

sync_common_snapshot_schedule

Schedule used to create common Snapshot copies for synchronous relationships.

sync_type

string

throttle

integer

Throttle in KB/s. Default to unlimited.

transfer_schedule

transfer_schedule

The schedule used to update asynchronous relationships. Only cron schedules are supported for SnapMirror.

type

string

uuid

string

Example request
{
  "_links": {
    "self": {
      "href": "/api/resourcelink"
    }
  },
  "comment": "string",
  "copy_all_source_snapshots": 1,
  "copy_latest_source_snapshot": 1,
  "create_snapshot_on_source": "",
  "identity_preservation": "string",
  "name": "Asynchronous",
  "retention": [
    {
      "count": 7,
      "creation_schedule": {
        "_links": {
          "self": {
            "href": "/api/resourcelink"
          }
        },
        "name": "weekly",
        "uuid": "1cd8a442-86d1-11e0-ae1c-123478563412"
      },
      "label": "hourly",
      "period": "P30D",
      "prefix": "string",
      "preserve": 1,
      "warn": 4
    }
  ],
  "rpo": 0,
  "scope": "string",
  "svm": {
    "_links": {
      "self": {
        "href": "/api/resourcelink"
      }
    },
    "name": "svm1",
    "uuid": "02c9e252-41be-11e9-81d5-00a0986138f7"
  },
  "sync_common_snapshot_schedule": {
    "_links": {
      "self": {
        "href": "/api/resourcelink"
      }
    },
    "name": "weekly",
    "uuid": "1cd8a442-86d1-11e0-ae1c-123478563412"
  },
  "sync_type": "string",
  "throttle": 0,
  "transfer_schedule": {
    "_links": {
      "self": {
        "href": "/api/resourcelink"
      }
    },
    "name": "weekly",
    "uuid": "1cd8a442-86d1-11e0-ae1c-123478563412"
  },
  "type": "string",
  "uuid": "4ea7a442-86d1-11e0-ae1c-123478563412"
}

Response

Status: 202, Accepted
Name Type Description

job

job_link

Example response
{
  "job": {
    "_links": {
      "self": {
        "href": "/api/resourcelink"
      }
    },
    "uuid": "string"
  }
}

Headers

Name Description Type

Location

Useful for tracking the resource location

string

Error

Status: Default

ONTAP Error Response codes

Error code
Description

---------

----------

6619714

Schedule specified is an interval schedule. SnapMirror does not support interval schedules.

13303850

Invalid input parameter

13303887

Failed to create SnapMirror policy. Reason: Maximum number of allowed retention rules reached

13304083

The specified property is not supported because all nodes in the cluster are not capable of supporting this property.

13304084

Properties specified are mutually exclusive. Provide only one property.

13304085

The specified property does not support the specified value.

13304092

Input value of the retention period property is invalid. For relationships with FlexVol volume or FlexGroup volume destinations, the duration must be in ISO 6801 format or can be infinite. For relationships with object store destinations, only duration values with Y, M or D and supported and must be in the specified range.

6621045

The property rentention.warn is not supported for a policy when the retention.preserve property is false.

6621067

Name Type Description

error

error

Example error
{
  "error": {
    "arguments": [
      {
        "code": "string",
        "message": "string"
      }
    ],
    "code": "4",
    "message": "entry doesn't exist",
    "target": "uuid"
  }
}

Definitions

See Definitions

href

Name Type Description

href

string

Name Type Description

self

href

creation_schedule

Schedule used to create Snapshot copies on the destination for long term retention. Only cron schedules are supported for SnapMirror.

Name Type Description

_links

_links

name

string

Job schedule name

uuid

string

Job schedule UUID

snapmirror_policy_rule

SnapMirror policy rule for retention.

Name Type Description

count

integer

Number of Snapshot copies to be kept for retention.

creation_schedule

creation_schedule

Schedule used to create Snapshot copies on the destination for long term retention. Only cron schedules are supported for SnapMirror.

label

string

Snapshot copy label

period

string

Specifies the duration for which the Snapshot copies are locked. The retention period value represents a duration and must be in the ISO-8601 duration format. Years, months, days, hours, minutes, and seconds are represented as "PY","PM","PD","PTH","PTM" and "PTS". Value "infinite" is also a valid input for Flexvol volumes and FlexGroup volumes. A duration which combines different periods is not supported, for example "P1Y10M" is not supported. The range of supported retention period values is between 1 second to infinite.

prefix

string

Specifies the prefix for the Snapshot copy name to be created as per the schedule. If no value is specified, then the label is used as the prefix.

preserve

boolean

Specifies the behavior when the Snapshot copy retention count is reached on the SnapMirror destination for the rule. The default value is false, which means that the oldest Snapshot copy is deleted to make room for new ones but only if the number of Snapshot copies has exceeded the retention count specified in the 'count' property. When set to true and where the Snapshot copies have reached the retention count, an incremental SnapMirror transfer will fail or if the rule has a schedule, Snapshot copies will be no longer be created on the SnapMirror destination.

warn

integer

Specifies the warning threshold count for the rule. The default value is zero. When set to a value greater than zero, an event is generated after the number of Snapshot copies (for the particular rule) retained on a SnapMirror destination reaches the specified warning limit. The preserve property for the rule must be true in order to set the warn property to a value greater than zero.

svm

Name Type Description

_links

_links

name

string

The name of the SVM.

uuid

string

The unique identifier of the SVM.

sync_common_snapshot_schedule

Schedule used to create common Snapshot copies for synchronous relationships.

Name Type Description

_links

_links

name

string

Job schedule name

uuid

string

Job schedule UUID

transfer_schedule

The schedule used to update asynchronous relationships. Only cron schedules are supported for SnapMirror.

Name Type Description

_links

_links

name

string

Job schedule name

uuid

string

Job schedule UUID

snapmirror_policy

SnapMirror policy information. SnapMirror policy can either be of type "async", "sync" or "continuous". The policy type "async" can be associated with a SnapMirror relationship that has either the FlexVol volume or FlexGroup volume or SVM as the endpoint. The policy type "sync" along with "sync_type" as "sync" or "strict_sync" can be associated with a SnapMirror relationship that has FlexVol volume as the endpoint. The policy type "sync" can have a "sync_type" of either "sync", "strict_sync" or "automated_failover". If the "sync_type" is "sync" then a write success is returned to the client after writing the data to the source endpoint and before writing the data to the destination endpoint. If the "sync_type" is "strict_sync" then a write success is returned to the client after writing the data to the both source and destination endpoints. If the "sync_type" is "automated_failover" then the policy can be associated with a SnapMirror relationship that has Consistency Group as the endpoint. Use the "sync" policy with "sync_type" as "automated_failover" to establish SnapMirror relationships for business continuity usecases. SnapMirror relationships with policy type as "sync" and "sync_type" as "automated_failover" can be monitored by the Mediator, if configured. In case the source Consistency Group endpoint is not reachable, the Mediator may trigger a failover to the destination Consistency Group endpoint. A policy of type "continuous" can be associated with SnapMirror relationships that have either ONTAP S3 buckets or NON-ONTAP object stores as endpoints. This type of policy is used for FabricLink owned targets.

Name Type Description

_links

_links

comment

string

Comment associated with the policy.

copy_all_source_snapshots

boolean

Specifies that all the source Snapshot copies (including the one created by SnapMirror before the transfer begins) should be copied to the destination on a transfer. "Retention" properties cannot be specified along with this property. This is applicable only to async policies. Property can only be set to 'true'.

copy_latest_source_snapshot

boolean

Specifies that the latest source Snapshot copy (created by SnapMirror before the transfer begins) should be copied to the destination on a transfer. "Retention" properties cannot be specified along with this property. This is applicable only to async policies. Property can only be set to 'true'.

create_snapshot_on_source

boolean

Specifies whether a new Snapshot copy should be created on the source at the beginning of an update or resync operation. This is applicable only to async policies. Property can only be set to 'false'.

identity_preservation

string

Specifies which configuration of the source SVM is replicated to the destination SVM. This property is applicable only for SVM data protection with "async" policy type.

name

string

Name of the policy.

network_compression_enabled

boolean

Specifies whether network compression is enabled for transfers. This is applicable only to the policies of type "async".

retention

array[snapmirror_policy_rule]

Rules for Snapshot copy retention.

rpo

integer

Specifies the duration of time for which a change to be propagated to a mirror should be delayed, in seconds. This is an intentional propagation delay between mirrors and is configurable down to zero, which means an immediate propagation. This is supported for policies of type 'continuous'.

scope

string

Set to "svm" for policies owned by an SVM, otherwise set to "cluster".

svm

svm

sync_common_snapshot_schedule

sync_common_snapshot_schedule

Schedule used to create common Snapshot copies for synchronous relationships.

sync_type

string

throttle

integer

Throttle in KB/s. Default to unlimited.

transfer_schedule

transfer_schedule

The schedule used to update asynchronous relationships. Only cron schedules are supported for SnapMirror.

type

string

uuid

string

Name Type Description

_links

_links

uuid

string

The UUID of the asynchronous job that is triggered by a POST, PATCH, or DELETE operation.

error_arguments

Name Type Description

code

string

Argument code

message

string

Message argument

error

Name Type Description

arguments

array[error_arguments]

Message arguments

code

string

Error code

message

string

Error message

target

string

The target parameter that caused the error.