Recently I have to do a job at the customer site: modify all snapshot of a Solidfire cluster with a specific snapmirror label.
The scope was to integrate the script with Commvault and accomplish the snapmirror relationship, from Solidfire to NetApp FAS, for only the snapshot created with Intellisnap, which a specific label.
The problem is that Intellisnap cannot create a snapshot with a specific label so we made this script for our goal.
The difficulty for us was modify in toto all the snapmirror_label (used to select which snap to transfer) of the snapshot create by Commvault.
I’ve done lots of work and test to select the best SDK and code to do this job.
Finally I present to you the final result done via the Python SDK for Solidfire.
The first step, for doing our job, consist in downloading the last Python version from the official site and install that with option “Add Python to PATH”.
On the website of the Solidfire Python SDK:
you can find the docs and the instruction to install the SDK.
Simply you can do that with this simple command:
pip install solidfire-sdk-python
After doing the command you are ready to begin with the final script, you can find it below:
from solidfire.factory import ElementFactory import re # Create connection to SF Cluster sfe = ElementFactory.create("192.168.13.207", "admin", "abc") # store the report of all snap and convert to string list_snap = str(sfe.list_snapshots()) # regular expression to find in the string all of the snap id and FOR to modify all snap with snapmirror_label nums = re.findall('snapshot_id=(.+?),', list_snap) for num in nums: sfe.modify_snapshot(num, snap_mirror_label="DR")
To adapt to your environment you can only change the IP Address and the User/Password. The result is that the script change all snapmirror_label to “DR” for all snapshot available on the Solidfire cluster. It can be useful to integrate the script in the PostSnap section of the Commvault’s subclient.
Ok nice job!
Finally my GitHub Repo about this script.
Have a nice day. Moo.