Skip to main content

Define a rule for a policy with ONTAP

Contributors netapp-aaron-holt netapp-dbagwell netapp-lenida netapp-thomi netapp-aherbin

For custom policies with the vault or mirror-vault policy type, you must define at least one rule that determines which snapshots are transferred during initialization and update. You can also define rules for default policies with the vault or mirror-vault policy type.

About this task

Every policy with the vault or mirror-vault policy type must have a rule that specifies which snapshots to replicate. The rule bi-monthly, for example, indicates that only snapshots assigned the SnapMirror label bi-monthly should be replicated. You specify the SnapMirror label when you configure the snapshot policy on the source.

Each policy type is associated with one or more system-defined rules. These rules are automatically assigned to a policy when you specify its policy type. The table below shows the system-defined rules.

System-defined rule

Used in policy types

Result

sm_created

async-mirror, mirror-vault, Sync, StrictSync

A snapshot created by SnapMirror is transferred on initialization and update.

all_source_snapshots

async-mirror

New snapshots on the source are transferred on initialization and update.

daily

vault,mirror-vault

New snapshots on the source with the SnapMirror label daily are transferred on initialization and update.

weekly

vault,mirror-vault

New snapshots on the source with the SnapMirror label weekly are transferred on initialization and update.

monthly

mirror-vault

New snapshots on the source with the SnapMirror label monthly are transferred on initialization and update.

app_consistent

Sync, StrictSync

Snapshots with the SnapMirror label app_consistent on source are synchronously replicated to the destination. Supported beginning with ONTAP 9.7.

Except for the “async-mirror” policy type, you can specify additional rules as needed, for default or custom policies. For example:

  • For the default MirrorAndVault policy, you might create a rule called bi-monthly to match snapshots on the source with the bi-monthly SnapMirror label.

  • For a custom policy with the mirror-vault policy type, you might create a rule called bi-weekly to match snapshots on the source with the bi-weekly SnapMirror label.

Step
  1. Define a rule for a policy:

    snapmirror policy add-rule -vserver SVM -policy policy_for_rule -snapmirror-label snapmirror-label -keep retention_count

    Learn more about snapmirror policy add-rule in the ONTAP command reference.

    The following example adds a rule with the SnapMirror label bi-monthly to the default MirrorAndVault policy:

    cluster_dst::> snapmirror policy add-rule -vserver svm1 -policy MirrorAndVault -snapmirror-label bi-monthly -keep 6

    The following example adds a rule with the SnapMirror label bi-weekly to the custom my_snapvault policy:

    cluster_dst::> snapmirror policy add-rule -vserver svm1 -policy my_snapvault -snapmirror-label bi-weekly -keep 26

    The following example adds a rule with the SnapMirror label app_consistent to the custom Sync policy:

    cluster_dst::> snapmirror policy add-rule -vserver svm1 -policy Sync -snapmirror-label app_consistent -keep 1

    You can then replicate snapshots from the source cluster that match this SnapMirror label:

    cluster_src::> snapshot create -vserver vs1 -volume vol1 -snapshot snapshot1 -snapmirror-label app_consistent