Storage Scripting

I thought I would start a new segment and see how well it does.  The premise will be around scripting (or at least automating) some common storage commands through the CLI of different storage arrays. 

Right now the focus will be on and around the VNX, but over time it should cover HP EVA and Netapp. I am sure there will be some Brocade peppered in there as well.

So what do I use for allot of my scripting with these different arrays? Excel

I use excel to build the syntax of the scripts, use some if statements to put data in the right place and copy and paste. Now for some of my more complex commands I will filter them through word and notepad (notepad to strip off cell settings etc, and word to search and replace special characters I use to put place holders in my excel script and replace with paragraph marks).

What I am going to be presenting is how I have done it for the last several years not to say this is the best way and by all means if you have better experience doing it other ways please share.  Excel, Word and notepad are what I typically use because I don’t have to ask for any special software, it is on almost every system I have used on a daily basis and at least with the Excel workbooks I have a history of what I did, and in a worst case scenario I can rebuild in a flash (or stand up a DR site with the exact same settings very quickly as well which is a better scenario than losing all of your data and having to rebuild). Also depending on how well you keep your workbook up to date you can do storage reports based off of it..

Let’s start with creating a lot of luns on the VNX.

Why would you need to manage a lot of luns that are not one off’s in your storage array VMWare, Exchange, Database servers.  This example will be around creating a lot of luns for VMWare.

Anytime I am creating a lot of luns that I feel are going to be evenly used I personally like to specify a few static things on the lun creation.

In this example I really utilize the fill down feature of excel (start with a number and then excel auto increments the next cells going down.  In this example I am wanting to create 10 luns for VMWare and I want my even numbered luns to be associated with pool 0 and SP B and conversely odd numbered luns with pool 1 and SP A.  First I create a table with the headings (if you are going to use this table start with Name in column B (we will be adding additional headings in the future):

Name Type Capacity(gb) Pool ALU SP Tiering initialTier
VNX-VMFS-001 Thin

2040

pool 1 1001 A autoTier optimizePool

After I have my heading and some sample data in there I can begin to use excel to build my commands.  As a formula further across in (column P) I have the excel formula of:

=”lun -create -type “&C2&” -capacity “&D2&” -sq gb -poolName “””&E2&””” -sp “&G2&” -l “&F2&” -name “””&LOWER(B2)&””” -tieringPolicy “&H2&” -initialTier ”

Now I just copy all of the settings down the rows and let the name cell auto increment down and I now have the beginning of my script to send to NaviCLI. 

Now you might be asking, I thought you wanted to load balance between the two SP’s and the two pools that you have… I do and here is the formula I have for that. 

Here lets replace E2 with: =IF(ISEVEN(RIGHT(B2,3)),”Pool 0″,”Pool 1″)

Please replace the pool names with your own if you are not using Pool 0 and Pool 1 (case matters)

Also lets replace G2 with the formula: =IF(ISEVEN(RIGHT(B2,3)),”B”,”A”)

Now you should have your luns load balanced between the two pools (if you are doing so) and if nothing else the two SP’s.

Now you might be asking can I copy and paste this as is? Not yet we need to call the navicli command which will understand all of this.

In O2 lets put our navisphere commands: =”NaviSECCli.exe -user sysadmin -Password sysadmin -Scope 0 -h VNX01SPA”

Now lets tie it all together in S2 with: =O2&” ”

And now we have a command we can copy and paste into a command prompt (of a system that has navicli installed and under a directory that can call the navicli command (typically it is something like “C:\Program Files (x86)\EMC\Navisphere CLI” and here is our complete command when we are done: “NaviSECCli.exe -user sysadmin -Password sysadmin -Scope 0 -h VNX01SPA lun -create -type Thin -capacity 2040 -sq gb -poolName “Pool 1” -sp A -l 1001 -name “vnx-vmfs-001″ -tieringPolicy autoTier -initialTier optimizePool”

Just fill the cells down in excel (have the Name cell auto increment the name) and have fun.

Later installment we will talk about adding the luns to a storage group, and dealing with multiple sites that we are replicating storage to and wanting the storage to match.

Advertisements
This entry was posted in Automating, Clariion, EMC, Excel, Storage Arrays, Utilities, VNX Block. Bookmark the permalink.

One Response to Storage Scripting

  1. cloydtatum1@yahoo.com says:

    This is an awesome idea of using excel for lun creation. Anyway you could send me a copy or sample of the spreadsheet?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s