Output from command processing

The command output can include information such as prompts, messages, and codes. For some commands, you can specify the output format.

Confirmation prompts

Commands might cause an unrecoverable operation, loss of data, memory drain, or a long-running task, or might have an impact on concurrent operations. In these situations, you receive an interactive confirmation prompt that asks if you are sure that you want to continue with the specific action, such as:
Are you sure you want to xxx? Y/N
All confirmation prompts accept the following input:
YES, yes, Y, y
Confirm the action and continue.
NO, no, N, n
Cancel the action.

Messages

Messages are returned in the format of IWNCxxxxy, IWNRxxxxy, IWNHxxxxy, or IWNExxxxy, where xxxx is the number of the message and y indicates that the message type is I (information), W (warning), or E (error).

Each CLI command issues a return value and message. These messages are output as follows:

  • Warning and informational messages are written to stdout.
  • Error messages are written to the standard error stream (stderr).
  • Messages include an explanation of the problem, if one exists.

Suppression of confirmation prompts and messages

You can use these flags to modify command input:
  • To force destructive action, such as making a volume even if the LUN already has a label, use the -f flag. This flag suppresses confirmation and error messages.
  • To suppress confirmation prompts and messages, use the -quiet flag. This flag answers yes to all confirmation prompts.

Return codes

The following table contains the codes that are returned by the csmcli command.

Table 1. Return codes for the csmcli command
Code Category Description
0 Success The command was successful.
2 Syntax error The syntax of the command was not correct.
3 Connection error A connectivity error or protocol error occurred.
4 Server error An error occurred during a function call to the application server.
5 Authentication error An error was detected during authentication checking.
6 Application error An error occurred during processing that is performed by the MetaProvider client application.
Notes:
  • In single-shot mode, an exit code is provided after each command.
  • In interactive and script mode, an exit code is not provided after each command. Instead, output is echoed to stdout for status information.
  • In single-shot and interactive mode, with commands that act on more than one argument if one or more operations fail, the CLI completes the following actions:
    • Complete processing of all operations that it can continue processing
    • Report on all successful completions
    • Report on any failures
  • In script mode, the CLI operates the same way. However, if one or more operations fail in the specified file, the CLI issues a failure exit code and automatically exits from the script mode after the failed command.

Options for setting the output format of listings

The standard format parameters set the output format of the listing (ls) commands in the CLI program. These parameters can be used either in one of the listing commands or in the setoutput command. The format settings remain in effect during the session or until you reset the parameters either by specifying these parameters in a listing command (commands that start with ls) or by using the setoutput command.
  • -p specifies whether to display one page of text at a time or all text at one time.
    • off displays all text at one time. This option is the default value when the csmcli command is run in single-shot mode.
    • on displays one page of text at time. Pressing any key displays the next page. This option is the default value when the command is run in interactive mode.
  • -r number specifies the number of rows per page to display when the -p parameter is on. The default value is 24. You can specify a value in the range 1 - 100.
  • -fmt specifies the format of the output. You can specify one of the following values:
    • default specifies that the output is displayed in a tabular format by using spaces as the delimiter between the columns. This parameter is the default value.
    • delim character specifies that the output is displayed in a tabular format by using the specified character to separate the columns. If you use a shell metacharacter as the delimiting character, enclose the character in quotation marks or single quotation marks. A blank space is not a valid character.
    • xml specifies that the output is displayed in XML format.
    • -hdr specifies whether to display the table header. Use the default value of on to display the table header. Use off to hide the table header.
  • -v specifies whether to enable verbose mode. Use the default value of off to disable verbose mode. This option is the default value. Use on to enable verbose mode.
These standard listing options modify command output in any CLI mode:
  • lsobject -s lists only the objects without other columns of information. For example, lssess –s lists only the name header and the session names.
  • lsobject -l lists all the objects with all defined columns, including the description.

Examples of using the setoutput command to define output formats

You can set output formats by using the setoutput command in interactive or script modes or by using the corresponding standard command options in single-shot mode.

setoutput with no options
When you issue setoutput with no options, the CLI always displays the current output settings in the default format (space-separated plain-text table), regardless of the values of the output settings. For example, enter the following command:
csmcli> setoutput
Paging  Rows  Format   Header  Verbose
======================================
off     -     default  on      off
setoutput –fmt delim char
To obtain long output in comma-separated format for the default storage pool only, enter the following commands:
csmcli> setoutput –fmt delim ,
csmcli> lssess –l –type default

The following output is then returned:

Name,Status,State,Copy Type,
Recoverable,Copying,Copy Sets,Error
===============================================================
session1,Inactive,Defined,Global Mirror Failover/Failback w/ Practice,
No,No,8,No
session2,Inactive,Defined,Global Mirror Failover/Failback,
No,No,0,No

To turn off headers, enter the command as shown in the following example:

csmcli> setoutput –fmt delim , -hdr off
csmcli> lssess –l –type default

The output would then be returned as follows:

session1,Inactive,Defined,Global Mirror Failover/Failback w/ Practice,
No,No,8,No
session2,Inactive,Defined,Global Mirror Failover/Failback,
No,No,0,No
setoutput –fmt xml
To obtain the long output in XML format for the default storage pool only, enter the following command:
csmcli> setoutput –fmt xml
csmcli> lssess –l –type default

The output is then returned in XML format as shown in the following example:

<IRETURNVALUE>
<INSTANCE CLASSNAME="STC_StoragePool"><PROPERTY NAME="Name" TYPE="string">
<VALUE>DEFAULT_POOL</VALUE></PROPERTY><PROPERTY NAME="PoolType" TYPE="uint32">
<VALUE>1</VALUE></PROPERTY><PROPERTY NAME="PartitionSize" TYPE="uint64">
<VALUE>16</VALUE></PROPERTY>
<PROPERTY NAME="AlertPercentage" TYPE="uint16"><VALUE>80</VALUE></PROPERTY>
<PROPERTY NAME="Size" TYPE="uint64"><VALUE>0</VALUE></PROPERTY>
<PROPERTY NAME="SizeAllocated" TYPE="uint64">
<VALUE>0</VALUE></PROPERTY><PROPERTY NAME="SizeAllocatedPercentage" TYPE="uint16">
<VALUE>0</VALUE></PROPERTY>
<PROPERTY NAME="NumberOfVolumes" TYPE="uint32"><VALUE>0</VALUE></PROPERTY>
<PROPERTY NAME="Description" TYPE="string"><VALUE>Default storage pool</VALUE>
</PROPERTY></INSTANCE>
</IRETURNVALUE>
setoutput –fmt default
To return the output format to the default (space-separated columns), enter the command as follows:
csmcli> setoutput –fmt default 
csmcli> lssess –l type default

The output is then returned as follows:

Name    Type    Size(GB) Used(GB) Used(%) Alert(%)  Volumes  
====================================================================
DEFAULT Default 10000    2500     25      80        10       

Partition  Size (MB)  Description
======================================
64         Default    Storage Pool
setoutput –fmt stanza
When columns are wide, output can be difficult to visually align. However, the stanza format option eliminates this problem. To obtain long output in stanza format for the default storage pool only, enter the command as follows:
csmcli> setoutput -fmt stanza
csmcli> lssess –l –type default

The output is then returned in the following format:

Name                  DEFAULT
Type                  Default
Size (GB)             10000
Used (GB)             2500
Used (%)              25
Alert (%)             80
Volumes               10
Partition Size (MB)   64
Description           Default storage pool

Name                  Personnel
Type                  System
Size (GB)             10000
Used (GB)             2500
Used (%)              25
Alert (%)             80
Volumes               20
Partition Size (MB)   64
Description           Personnel data