SnapMirror failover
So I helped a customer a few months ago (before SRM) to script a complete site failover. It will bring the DR site online within about 30 minutes, the scripts are a bit clunky and need a massive re-design, so I thought I’d post the originals here.
This, I think, is a great example of how flexible the NetApp systems are in that you can quickly and easily setup SSH access from a management host and script your heart away! Soon as I get the hang of the API, I’m sure there’ll be plenty more info coming along too.
This script will bring all volumes online on the DR filer, what’s more, an volume that is labelled as “_vm” at the end (which is a nice naming convention to use for all VMware volumes anyway), will get re-mapped to a new igroup you choose and already have setup for the DR ESX servers.
I’ve modified this script slightly since writing it to remove filer names, so I don’t expect it to work out of the box, as with my other scripts, it’s just meant to as an example of how this can be achieved.
[root@esx101 root]# cat failover.sh
#!/bin/bash
dr_vmware_igroup=”VMWare_DR”
dr_filer_name=”filer_dr”
dr_filer_command=”ssh -c 3des $dr_filer_name”
for netapp_volume in `$dr_filer_command snapmirror status | grep $dr_filer_name | grep -v “_vm” | cut -d”:” -f3 | cut -d ” ” -f1`; do
echo $dr_filer_command snapmirror quiesce $netapp_volume
echo $dr_filer_command snapmirror break $netapp_volume
echo $dr_filer_command vol online $netapp_volume
done
for netapp_volume in `$dr_filer_command snapmirror status | grep $dr_filer_name | grep “_vm” | cut -d”:” -f3 | cut -d ” ” -f1`; do
echo $dr_filer_command snapmirror quiesce $netapp_volume
echo $dr_filer_command snapmirror break $netapp_volume
echo $dr_filer_command vol online $netapp_volume
for netapp_lun in `$dr_filer_command lun show | grep /vol/$netapp_volume | awk ‘{print $1}’`; do
echo $dr_filer_command lun online $netapp_lun
echo $dr_filer_command lun map $netapp_lun $dr_vmware_igroup
done
done
Similar Articles:










































How are you Mr Kranz?
Have you made any enhancements to the script since posting?
Cheers, Ty
Hi Ty!
Unfortuantely I’ve not been able to make any progress on any of the scripts here. I’ll be sure to update them as soon as I have though. I’m hoping to start converting them all to PowerShell first to make them more Windows friendly.