I know I said that Part 5 would be my last LeftHand post for the time being but I couldn’t resist building a script to test out all of the scripting commands we just went through. So I created two scripts that do the following.
-Creates a snapshot of a volume
-Assigns it to a server
-Attaches it to the server for access
-Logs the ISCSI session off
-Un-assigns it from the server (removes the target portal)
-Deletes the snapshot
Take a look at it if you’d like, feel free to use any of the code yourself. If you are going to use the entire batch file yourself, I ask that you leave the header in place that gives credit to this blog. I’m contemplating making a CHAP version as well but I’ll have to find some time first.
I, in no way, shape, or form guarantee this code to work. It worked on my configuration but you might need to tweak it a little yourself. I tried to document it as best as I could. Furthermore I am not claiming this as my own completely original work. I used a lot of other concepts and examples that I found online to build the scripts.