class SANStore::CLI::Commands::ListVols
@author David Love
The list_vols
command show the current iSCSI targets available on this host
Public Instance Methods
aliases()
click to toggle source
The aliases this sub-command is known by
# File lib/SANStore/cli/commands/list_vols.rb, line 38 def aliases [ "list_vol", "list", "ls" ] end
long_desc()
click to toggle source
A longer description, detailing both the purpose and the use of this command
# File lib/SANStore/cli/commands/list_vols.rb, line 51 def long_desc 'Displays a list of valid iSCSI targets, all of which ' + 'should be available on the local network' + "\n\n" 'NOTE: Because of the way iSCSI works, this host has no ' + 'way of knowing what is actually '+ ANSI.bold{ "in" } + ' the volume. So even ' + 'if a target is defined, this host has no way of knowing if ' + 'a given initiator can actually ' + ANSI.bold{ "use" } + 'the contents of this volume. If something appears to be ' 'wrong, check the set-up of the host to make sure it can ' 'actually connect to the targets defined here.' end
name()
click to toggle source
The name of the sub-command (as it appears in the command line app)
# File lib/SANStore/cli/commands/list_vols.rb, line 33 def name 'list_vols' end
option_definitions()
click to toggle source
Define the options for this command
# File lib/SANStore/cli/commands/list_vols.rb, line 69 def option_definitions [ ] end
run(options, arguments)
click to toggle source
Execute the command
# File lib/SANStore/cli/commands/list_vols.rb, line 75 def run(options, arguments) # Get the list of defined volumes volumes = COMStar.list_vols # Show the list to the caller text = String.new volumes.each{|target| text << sprintf("%-60s ", target[:name]) if target[:state] == "online" then text << sprintf("%-20s ", ANSI.green{ target[:state] }) else text << sprintf("%-20s ", ANSI.black{ target[:state] }) end if target[:sessions].to_i > 0 then text << sprintf("%-10s\n", ANSI.white{ target[:sessions] }) else text << sprintf("%-10s\n", ANSI.black{ target[:sessions] }) end } puts sprintf("%-68s %-19s %-10s\n", ANSI.bold{ "Target Name"}, ANSI.bold{ "Status" }, ANSI.bold{ "Open Sessions" }) puts text end
short_desc()
click to toggle source
A short help text describing the purpose of this command
# File lib/SANStore/cli/commands/list_vols.rb, line 45 def short_desc 'Show the currently defined iSCSI targets on this host.' end
usage()
click to toggle source
Show the user the basic syntax of this command
# File lib/SANStore/cli/commands/list_vols.rb, line 64 def usage "store list_vols" end