WFA: Determining if a Volume Has a SnapMirror that’s not a Vault

Note: Version of OnCommand Workflow Automation here is 3.1P2.

If you want to create a workflow that takes information for a source cluster, source SVM, source volume, and then only does an action if there’s a SnapMirror that’s not a vault (like snapmirror break), the in-box filter ‘Filter SnapMirror relationships by source volume’ doesn’t quite serve the purpose, we need to enhance the filter. The following post shows how to do this, and a basic example of how to use the custom filter in a workflow.

Part 1) Creating the Custom Filter

Image: Clone and Edit the Filter ‘Filter SnapMirror relationships by source volume’

1.1) Click the Designer tab
1.2) Click Filters in the left pane
1.3) Search for ‘Filter SnapMirror relationships by source volume
1.4) Select the filter and click the Clone button

1.5) New Filter: Properties tab …
… change Name to: ‘Filter SnapMirror relationships by source volume (no vaults)

1.6) New Filter: Query tab …
… edit the SQL Query to the below (additional lines added to the original query are highlighted):


SELECT
    snapmirror.id,
    src_volume.name AS 'volume.name',
    dest_volume.name AS 'secondary_volume.name',
    src_vserver.name AS 'volume.vserver.name',
    dest_vserver.name AS 'secondary_volume.vserver.name',
    src_cluster.primary_address AS 'volume.vserver.cluster.primary_address',
    dest_cluster.primary_address AS 'secondary_volume.vserver.cluster.primary_address'
FROM
    cm_storage.snapmirror,
    cm_storage.snapmirror_policy,
    cm_storage.cluster src_cluster,
    cm_storage.cluster dest_cluster,
    cm_storage.vserver src_vserver,
    cm_storage.vserver dest_vserver,
    cm_storage.volume src_volume,
    cm_storage.volume dest_volume
WHERE
    snapmirror.secondary_volume_id = dest_volume.id
    AND snapmirror.volume_id = src_volume.id
    AND dest_volume.vserver_id = dest_vserver.id
    AND src_volume.vserver_id = src_vserver.id
    AND dest_vserver.cluster_id = dest_cluster.id
    AND src_vserver.cluster_id = src_cluster.id
    AND (
        src_cluster.name = '${source_cluster_name}'
        OR src_cluster.primary_address='${source_cluster_name}'
    )
    AND src_vserver.name = '${source_vserver_name}'
    AND src_volume.name = '${source_volume_name}'
    AND snapmirror_policy.id = snapmirror.snapmirror_policy_id
    AND snapmirror_policy.type != 'vault'


1.7) Click Save

Note: I use snapmirror_policy.type != ‘vault’, rather than snapmirror.type != ‘xdp’, since an XDP mirror might not be a vault (i.e. MirrorVault which is breakable.)

Part 2) An Example Using the Custom Filter

The following example is about as simple as it gets - just purely for illustrating the use of the custom filter.

2.1) Click the Designer tab
2.2) Click Workflows in the left pane
2.3) Click the New workflow button
2.4) If the ‘Workflow Checklist’ pops up, click ‘Start Now
2.5) On the Workflow tab, under ‘Available Steps’, expand none, and drag ‘Search or define’ to the workspace
2.6) On the Workflow tab, under ‘Available Steps’, expand cm_storage, and drag ‘Break SnapMirror’ to the workspace

Image: The workflow so far…

2.7) Double-click ‘Search or define’ in the workspace, and edit the name to say ‘Locate SnapMirror (not vault)
2.8) To the right of 1, click on the + underneath ‘Locate SnapMirror (not vault)’

Image: Click here

2.9) For ‘Dictionary Entry’ choose SnapMirror under cm_storage
2.10) Change Define SnapMirror to ‘snapmirror_not_vault
2.11) Leave the drop down on ‘by searching for an existing SnapMirror
2.12) Click the ‘Enter search criteria

Image: Enter search criteria

2.13) Tick the ‘Filter SnapMirror relationships by source volume (no vaults)
2.14) Under Parameters…
… Source Cluster name or IP: $cluster
… Source Volume name: $volume
… Source Storage Virtual Machine name: $vserver

Image: Resource Selection

2.15) Click OK
2.16) Change the dropdown to the right of ‘If … was not found:’ to ‘Disable this command
2.17) Click OK

2.18) To the right of 1, click on the + underneath ‘Break SnapMirror’
2.19) On the SnapMirror tab, change the dropdown to ‘by using a previously defined SnapMirror’ and …
2.20) … enter ‘snapmirror_not_vault’ to the left of the dropdown
2.21) On the Advanced tab, change the dropdown to ‘If the following variable was found’ and …
2.22) … enter ‘snapmirror_not_vault’ underneath
2.23) Click OK

Image: Parameters for ‘Break SnapMirror’ - SnapMirror tab

Image: Parameters for ‘Break SnapMirror’ - Advanced tab

2.24) On the Details tab for the workflow, enter a Workflow Name ‘Break SnapMirror if it’s not a Vault’ …
2.25) … and tick ‘Ready for production
2.26) Click ‘Save As
2.27) Click Save

Job done!

Comments