As a storage administrator one of most boring tasks I have to do is making and allocating new storages to hosts. To me it’s the equivalent of creating a user. Easy to do, but very boring. If you know me at all, which you probably don’t, you know I hate boring. For a lot of people it’s just a few right clicks in SMC/Unisphere and you’ve got yourself a new LUN. For me it’s a quick SSH into a server with SYMCLI, a few edits to files, a few commands, and bam. I’d rather spend my time working on future planning, new architecture, or almost anything else. I finally had enough free time to write some Perl code which parses a simple text file to create new Meta devices on an EMC VMAX array.
Actually creating a new Meta device is a fairly simple thing: First you create the thin devices, then you combine them all together into a Meta device, allocate or bind that new Meta devices to a storage pool, then put the newly bound Meta device into a storage group. It’s not time consuming, but we are all always looking for better ways to do things faster. “Do more with less” applies to our time just as much as it does with our budget dollars.
[box]Now it’s time for a short note and small disclaimer. This script works for me in my environment. Do your homework and make this work for you. While I have tried to make this robust and fully functional, it’s important to note “stuff happens”, this is still provides “as is” with no warranty whatsoever. Use at your own risk and all that jazz.[/box]
If you look in the archive you’ll find three files. The first Perl script is named “subs.pl” and contains all the code to generate SYMCLI config files and actually execute the commands. The seconds Perl script contains the logic to actually run all the subroutines in “subs.pl”. The third is a simple text file which is parsed by the aforementioned Perl scripts to actually know what size meta devices to make, what pool to bind them to, and what storage group they belong it. It’s fairly robust with options to testing rather than creating, optionally adding the new device to storage group, and clean up after itself.
To run the script you simple edit the included “cfg_file” to reflect the size of the Meta devices you want to create, the storage group they belong to, and the storage group to bind them to. The format is simply “SizeInGB:StorageGroupName:StoragePoolName”. Each line will be treated as a new meta device to create. You probably want to modify “create_lun.pl” to reflect the correct tdev size for your environment (remember it’s in Cylinders and GB!). Then you just actually run the command:
[box] ./create_lun.pl –sid XXXX –cfg_file ./cfg_file –clean –sg[/box]
By default you won’t see much output returned other than the fact that its working and finished correctly – the output of symcli is suppressed unless the “-echo” is used. If you don’t want to create any new devices and just want to run through the motioned you can use the “-test” option. If you omit the “-sg” option the new Meta device will not be added to any storage group specified. If you don’t specify “-clean” the symcli cfg files will be left intact.
Hopefully someone else finds this handy.
Comments are closed, but trackbacks and pingbacks are open.