3PAR Dynamic Optimization Script

Post Reply
User avatar
Richard Siemers
Site Admin
Posts: 1333
Joined: Tue Aug 18, 2009 10:35 pm
Location: Dallas, Texas

3PAR Dynamic Optimization Script

Post by Richard Siemers »

Pre 3.1.1, I don't have a tunesys option, therefore to DO the entire system, I need to DO each VV, well thats over 600 objects in my case. Here is a msdos script I wrote to loop through a list of VVs. I created several imput files based on the destination CPG I wanted to send the volumes to.. (one for Dev_Tier2, Dev_Tier3, Prod_Tier2, Prod_Tier3, etc).

requires 3par inform CLI to be installed on the PC.
requires an text file containing a list of VVs to DO.
requires using "setpassword -saveonly -file filename" command to create encrypted password file so that you dont have to enter credentials for each loop.

This method runs one DO at a time, waits for it to finish before starting another. I prefer this method over issuing all 600 commands, and letting the system run 4 at time with the rest queued up. In case of performance impact, failed drives, etc, its much easier to control-C the batch file than it is to clean out the queue of pending jobs.

The script can/should be edited for snap_cpgs if you have those.

Code: Select all

@ECHO OFF
::  Set the hostname of the 3par storage system here
set TPDSYSNAME=ESFWT800-1
:: Set the location of the pwfile you created with "setpassword -saveonly -file"
set TPDPWFILE=ESFWT800-1_RW.pwfile
:: Add the path of the 3PAR cli bin folder to your existing path
set PATH=C:\Program Files (x86)\inform_cli_3.2.1\bin;%PATH%

:: Main loop, change the name of your file here, the parenthesis () need to stay. Also edit the name of the destination CPG.  Input File should have no blank lines, headers/footers, one vv per line with no extra spaces at the end.


FOR /F %%i in (NAME_OF_YOUR_VV_FILE) do call :Begin %%i
echo ::: End of Loop
goto :END

:Begin
echo ::: Beginning Optimization of %1
call tunevv usr_cpg YOUR_DESTINATION_CPG_HERE -f -waittask %1
if ERRORLEVEL 1 pause

:END




Never run scripts you don't fully understand/comprehend yourself. This is provided for academic reasons, use at your own risk. It was designed for my environment, your mileage may vary.
Richard Siemers
The views and opinions expressed are my own and do not necessarily reflect those of my employer.
zQUEz
Posts: 33
Joined: Mon Aug 20, 2012 1:54 pm
Location: Atlanta, GA

Re: 3PAR Dynamic Optimization Script

Post by zQUEz »

Just to add to this repository of information, I am adding a linux bash shell script that does the same. I created this a while ago when we got bit by tunesys going a little awry, and now that we have just added some more disk, I am actually using this again instead of tunesys only because I have a bit more control.
Like the windows version posted above, it only kicks off a new migration once it finds no other jobs running and only does one at a time.
As each VV migration is started it also removes that name from your list. This is so you can start/stop easily where you left off.

Dependancies:
1) You need to have your ssh key files setup so that you can automatically login to the 3PAR frame.
2) modify the 4 variables at the beginning of the script for your environment.

Code: Select all

#!/bin/bash

### User defined each time script is run
vLISTOFVVS="/path/to/vvs_to_move"
vNEWCPG="FC_R5_S9_1"
EMAILTO="someone.who.cares@company.com"


### Static variables
FRAMENAME="3pararrayname"


### MAIN
for VV in `cat $vLISTOFVVS`; do
        while [ "`ssh $FRAMENAME \"showtask -active\"`" != "No tasks." ]; do
                echo "`date`: Waiting 1 min for running tasks to finish."
                sleep 60
        done

        vCOMM="tunevv usr_cpg $vNEWCPG -f $VV"
        echo "`date`: Running command - $vCOMM"
       ssh $FRAMENAME "$vCOMM"

        sed -i "/$VV/d" $vLISTOFVVS
        echo $?
done

echo "3PAR finished migration" |mail -s "3PAR Finished migration" $EMAILTO
User avatar
Richard Siemers
Site Admin
Posts: 1333
Joined: Tue Aug 18, 2009 10:35 pm
Location: Dallas, Texas

Re: 3PAR Dynamic Optimization Script

Post by Richard Siemers »

Thanks! Much appreciated.
Richard Siemers
The views and opinions expressed are my own and do not necessarily reflect those of my employer.
Post Reply