VMware Solutions Discussions

SMVI : Running a Post Backup PowerShell Script

richard_heath
4,011 Views

Hi,

I need some help and guidence on scripting in SMVI? I have a power shell script that creates a SV snapshot and updates as Snap vault relationship from a consistant snapshot on the primary filer. I want this to run once the SMVI job has completed but I cant get this to work. The powershell script work fine if run independantly and I have checked that this is not a permissions issue. Please can some one point me to some same scripts or setup guides me on how to get this working as currently SMVI just gives a time out error?

Import-Module DataONTAP 
Write-Debug "Begin Main Functions"

# Comfirm succesfull backup

write-eventlog -logname Application -source SMVI -EventID "9990" -EntryType Information -message "SMVI Snapvault Update Started" 
# Connect to Snapvault secondary

Write-Debug "Connect to Controller"Connect-NaController -Name Secondary

#Update Snapvault Secondaries and transfer from primary Snapshot

Write-Debug "Snapshot Secondary"

Start-NaSnapvaultSecSnapshot -VolumeName SV_Secondary -ScheduleName SV_Nightly

Write-Debug "Snapvault to Secondary"

Start-NaSnapvaultSecTransfer -SecondaryPath /vol/SV_Secondary/Q_SV_Secondary -PrimarySnapshot smvi_PROD_BACKUPS_novmsnap_recent


Thanks in advance...

1 ACCEPTED SOLUTION

amritad
4,011 Views

Here’s a sample script

REM CONTROLLER is the SnapVault target NetApp Controller

set CONTROLLER=torfiler3

REM SECPATH is the path to the SnapVault Volume on the target controller including the qtree

set SECPATH=/vol/vmblock1vault/vmblock1

REM SVSCHED is the schedule name for the retention schedule configured on the SnapVault volume

set SVSCHED=smvi_weeklyvault

REM SVVOLUME is the SnapVault target volume not including the qtree

set SVVOLUME=vmblock1vault

REM USER is the limiter user id for the SnapVault transfer

set USER=limited-SV-user

REM PASSWORD is the password for the limited user

set PASSWORD=smv1rocks

REM SNAPNAME is the name of the snapshot to be transfered

set SNAPNAME=smvi__weeklyISCSI1_recent

REM ZAPIPATH is the path to the ONTAP SDK

set ZAPIPATH="E:\Program Files\NetApp\Virtual Storage Console\smvi\server\scripts"

REM LOGPATH Is the path to the log generated by the SMVI script

set LOGPATH="E:\Program Files\NetApp\Virtual Storage Console\smvi\server\log\scripts"

REM LOGFILE is the logfile generate by the SMVI script

set LOGFILE=SnapVaultScript.log

if %BACKUP_PHASE% == POST_BACKUP goto doSnapVault

goto ende

:doSnapVault

echo SCRIPT STARTING FOR SMVI JOB:%BACKUP_NAME%>>%LOGPATH%\%LOGFILE%

echo BEGIN SNAPVAULT UPDATE>>%LOGPATH%\%LOGFILE%

chdir %ZAPIPATH%>>%LOGPATH%\%LOGFILE%

echo BEGIN SNAPVAULT UPDATE FOR %SVVOLUME%>>%LOGPATH%\%LOGFILE%

apitest.exe %CONTROLLER% %USER% %PASSWORD% snapvault-secondary-initiate-incremental-transfer primary-snapshot %SNAPNAME% secondary-path %SECPATH%>>%LOGPATH%\%LOGFILE%

apitest.exe %CONTROLLER% %USER% %PASSWORD% snapvault-secondary-initiate-snapshot-create schedule-name %SVSCHED% volume-name %SVVOLUME%>>%LOGPATH%\%LOGFILE%

echo END SNAPVAULT UPDATE FOR %SVVOLUME%>>%LOGPATH%\%LOGFILE%

echo

View solution in original post

3 REPLIES 3

amritad
4,012 Views

Here’s a sample script

REM CONTROLLER is the SnapVault target NetApp Controller

set CONTROLLER=torfiler3

REM SECPATH is the path to the SnapVault Volume on the target controller including the qtree

set SECPATH=/vol/vmblock1vault/vmblock1

REM SVSCHED is the schedule name for the retention schedule configured on the SnapVault volume

set SVSCHED=smvi_weeklyvault

REM SVVOLUME is the SnapVault target volume not including the qtree

set SVVOLUME=vmblock1vault

REM USER is the limiter user id for the SnapVault transfer

set USER=limited-SV-user

REM PASSWORD is the password for the limited user

set PASSWORD=smv1rocks

REM SNAPNAME is the name of the snapshot to be transfered

set SNAPNAME=smvi__weeklyISCSI1_recent

REM ZAPIPATH is the path to the ONTAP SDK

set ZAPIPATH="E:\Program Files\NetApp\Virtual Storage Console\smvi\server\scripts"

REM LOGPATH Is the path to the log generated by the SMVI script

set LOGPATH="E:\Program Files\NetApp\Virtual Storage Console\smvi\server\log\scripts"

REM LOGFILE is the logfile generate by the SMVI script

set LOGFILE=SnapVaultScript.log

if %BACKUP_PHASE% == POST_BACKUP goto doSnapVault

goto ende

:doSnapVault

echo SCRIPT STARTING FOR SMVI JOB:%BACKUP_NAME%>>%LOGPATH%\%LOGFILE%

echo BEGIN SNAPVAULT UPDATE>>%LOGPATH%\%LOGFILE%

chdir %ZAPIPATH%>>%LOGPATH%\%LOGFILE%

echo BEGIN SNAPVAULT UPDATE FOR %SVVOLUME%>>%LOGPATH%\%LOGFILE%

apitest.exe %CONTROLLER% %USER% %PASSWORD% snapvault-secondary-initiate-incremental-transfer primary-snapshot %SNAPNAME% secondary-path %SECPATH%>>%LOGPATH%\%LOGFILE%

apitest.exe %CONTROLLER% %USER% %PASSWORD% snapvault-secondary-initiate-snapshot-create schedule-name %SVSCHED% volume-name %SVVOLUME%>>%LOGPATH%\%LOGFILE%

echo END SNAPVAULT UPDATE FOR %SVVOLUME%>>%LOGPATH%\%LOGFILE%

echo

raimiansch
4,011 Views

Hi Amritad!

You use the line if %BACKUP_PHASE% == POST_BACKUP goto doSnapVault in you script. Means that, that it is also possible to start scripts befor the backup (PRE scripts)?

I cannot find a documentation about the scripts for SMVI (SVC 2.0). Which parameters are possible and so on.

Have you some docu?

Thanks

Rainer

amritad
4,011 Views

Hi

You can take a look at the SMVI BPG. Here’s the link to this

http://media.netapp.com/documents/tr-3737.pdf

Also we have a SnapVault integration script that you can take a look at

http://communities.netapp.com/docs/DOC-8720#comment-4130

Regards

Amrita

Public