So it turns out the only thing harder than writing blog posts is keeping up with other people’s blog posts (actually it’s easy to write blog posts…. it’s just hard to write good and useful ones). So when I ranted last week about the lack of Unix tools in the SVC/Storwize rbash shell, it turns out I had missed the memo… they have finally arrived! Barry Whyte revealed all here:
It has been an interesting journey to watch the SVC code base mature and expand its horizons as it has gone from a straight storage virtualization platform to a storage controller platform as well. In the process the effective user base for this platform has increased dramatically, I suspect well in excess of 10x fold. And with that increase comes much more pressure on usability. In the CLI space, the first big thing to change was that IBM dropped the requirement to use private/public keys to login to the CLI shell. The fact of the matter is that many storage admins are not UNIX experts… they don’t use PuTTY in their daily lives and running PuttyGen to generate keys felt positively strange to them. They just wanted to type a username and password and be logged in…. and that is precisely what they got.
The need to preface info and task types commands with svcinfo and svctask also went by the wayside, which made things simpler as well (although I usually leave them in sample scripts for the ultimate backwards compatibility).
But in the opposite direction was the restricted bash shell that the CLI user gets to live in. Unix users (particularly those power users who know how to bash out a complex awk command in 40 keystrokes), were all a little stunned that they had to run all the cool commands outside the SSH command. Telling them it has been that way for 12 years didn’t make them feel any better.
So with the 7.5 release (which is still fairly steaming new), you get 11 Unix shell commands that are all very very sweet:
cut grep head less more sed sort tail tr uniq wc
So for a simple example, if I want to grab just the VDisk IDs for all VDisks I would normally use a command like this one: lsvdisk -delim , -nohdr | cut -d”,” -f1
Run on a pre 7.5 machine I get:
IBM_Storwize:anthonyv> lsvdisk -delim , -nohdr | cut -d"," -f1 rbash: grep: command not found
On a 7.5 machine I get:
IBM_Storwize:anthonyv>lsvdisk -delim , -nohdr | cut -d"," -f1 0 1 2 3 4 5 6
What’s nice is that a Windows admin firing commands with plink can now get unix commands run on the remote side with just a Windows plink command on the local side.
My only complaint is lack of floating point support. Bash by default does not handle floating point. To prove this, here is an amusing example where we get bash to perform some division:
IBM_Storwize:anthonyv>echo "4 divided by 2 equals $(( 4/2 ))" 4 divided by 2 equals 2 IBM_Storwize:anthonyv>echo "2 divided by 4 equals $(( 2/4 ))" 2 divided by 4 equals 0
I normally use awk to handle floating point calculations, so if you were to sum the size in bytes of a number of MDisks and then divide by 1024 to get GiB you may want to get a result to say three decimal places, but with bash built ins and the tools so far exposed to the rbash user, you cannot do this. The bc command can also handle floating point, so next time you see your IBM rep, say ‘nice try but you missed floating point’.
Let me know what they say. #;-)