Daily IT Matters, this is the place where I post my daily findings on IT.

Thursday, January 21, 2010

CentricStor i500 Scalar [Tape handling]

This is script is created to easy the tapehandling of Quantum i500 scalar robot in combination with a centricstor.

All you have to do now is to insert the tapes in IO, then on the screen hit library.
tapes are now available for the library. We now need to assign the tapes in IO to the Library. And then to a Volume Group.

1. jukeadm /dev/fsc/CentricStor/c16t000073l1 l s
this command lists all slots from the library.
2. jukeadm /dev/fsc/CentricStor/c16t000073l1 l i
this command lists all IO slots
3. jukeadm /dev/fsc/CentricStor/c16t000073l1 m i s
this command moves a tape from IO to a Slot in the library
4. plmcmd conf -I -V -G


'Script om tapes te importeren.
'De tapes worden vanuit IO sloten naar sloten in de robot geplaatst.

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim oShell
Dim oShell2
Dim bIOSlotFound
Dim inpPoolName

iCounter = 0
inpPoolName = "XXXXXX"
bPoolFound = False

strEmptySlotsPath = "e:\centricstor\out\empty_slots.txt"
strUsedIOPath = "e:\centricstor\out\used_io_slots_tapenumbers.txt"
strPoolsCentricStore = "e:\centricstor\volume_pools_centricstor.txt"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Lees de file volume_pools_centricstor in 2x 1x in een Array en later in een textObject.
Set objFSO3 = CreateObject("Scripting.FileSystemObject")
Set objTextFile3 = objFSO3.OpenTextFile(strPoolsCentricStore, ForReading)

strPools = objtextFile3.ReadAll
arrPools = Split(strPools, vbNewLine)

'Lees de file voor een 2x in.
Set objTextFile3 = objFSO3.OpenTextFile(strPoolsCentricStore, ForReading)

'Hier vragen we de poolnaam uit.
Do While (objTextFile3.AtEndOfStream <> True) And (bPoolFound = False) Or (Len(inpPoolName) < 6)
strLine3 = objtextFile3.ReadLine
If InStr(strLine3,inpPoolName) Then
bPoolFound = True
Else
WScript.Echo "Beschibare Pools"
WScript.Echo ""
For i = 1 To UBound(arrPools)
WScript.Echo arrPools(i)
Next
inpPoolName = UCase(InputBox("Geef de poolname op waar je de tapes wilt plaatsen:"))
End If
Loop

If Not bPoolFound Then 'Pool komt niet voor
WScript.Echo inpPoolName & " komt niet voor, geef juiste poolnaam op"
WScript.Quit
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Request Slot list and IO Slots from robot.
'' and create text file containing those lists.
'' Then read the created text files
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set oShell = wscript.createobject("wscript.shell")

oShell.Run "cmd /c E:\cygwin\bin\ssh root@172.16.4.130 jukeadm /dev/fsc/CentricStor/c16t000073l1 l s > e:\centricstor\out\empty_slots.txt"
WScript.sleep 20000 'Dit om de robot tijd te geven om de output te maken
oShell.Run "cmd /c E:\cygwin\bin\ssh root@172.16.4.130 jukeadm /dev/fsc/CentricStor/c16t000073l1 l i > e:\centricstor\out\used_io_slots_tapenumbers.txt"
WScript.sleep 20000 'Dit om de robot tijd te geven om de output te maken

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strEmptySlotsPath, ForReading)

Set objFSO2 = CreateObject("Scripting.FileSystemObject")
Set objTextFile2 = objFSO2.OpenTextFile(strUsedIOPath, ForReading)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Do While objTextFile.AtEndOfStream <> True
strLine = objtextFile.ReadLine
If InStr(strLine,":") = 5 Then ' Als er op positie 5 een ':' staat dan is het een slot.
'Dit is een slot in de output
iSlotnr = cleanString(Mid(strLine,1,4))
iTapenr = cleanString(Mid(strLine,7,6))
If iTapenr = "" Then 'Destination slot gevonden
bIOSlotFound = False
Do While bIOSlotFound = False And objTextFile2.AtEndOfStream <> True
'Escape from while loop if
If iCounter = 1000 Then
bIOSlotFound = True
End If
strLine2 = objtextFile2.ReadLine
If InStr(strLine2,":") = 5 Then ' Als er op positie 5 een ':' staat dan is het een slot.
iSlotnrIO = cleanString(Mid(strLine2,1,4))
iTapenrIO = cleanString(Mid(strLine2,7,6))
If Not iTapenrIO = "" Then '
bIOSlotFound = True
oShell.Run "cmd /c E:\cygwin\bin\ssh root@172.16.4.130 jukeadm /dev/fsc/CentricStor/c16t000073l1 m i " & iSlotnrIO & " s " & iSlotnr & ""
WScript.sleep 20000
oShell.Run "cmd /c E:\cygwin\bin\ssh root@172.16.4.130 plmcmd conf -I -V " & iTapenrIO & " -G " & inpPoolName
WScript.sleep 20000
End If
End If
icounter = icounter + 1
Loop
End If
End If
Loop

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function cleanString(theString)
strAlphaNumeric = "0123456789"'Used to check for numeric characters.
For i = 1 to len(theString)
strChar = mid(theString,i,1)
If instr(strAlphaNumeric,strChar) Then
CleanedString = CleanedString & strChar
End If
Next
CleanTheString = CleanedString
End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Cleanup
Set oShell = Nothing
Set objFSO = Nothing
Set objFSO2 = Nothing
Set objFSO3 = Nothing

No comments:

Google