+ CLI Guide Overview

From OSNEXUS Online Documentation Site
Jump to navigation Jump to search

The QuantaStor command line interface (CLI) can be used to remotely manage your QuantaStor based systems via a Windows or Linux system, and it is also a powerful tool for scripting the configuration and provisioning of storage volumes, network shares, and other resources. The command line utility for managing your QuantaStor system is called simply 'qs'. You can run 'qs' after logging into your QuantaStor system via an SSH connection, or you can download the QuantaStor Remote CLI client installer for Windows which is available for download from the OSNEXUS web site.

How to use the CLI

QuantaStor CLI is a full featured interface into all of the QuantaStor management features and can communicates with the local core management service as well as remote storage appliances.

Authentication

It is important to note that running the qs CLI locally as root affords no additional access privileges. Each command run via the CLI must include the --server specification which includes which server and what credentials should be used to access the appliance with.

Authentication via --server Argument

All CLI commands accept the server specification argument which is of this form:

[--server=ipaddress[,username,password]]

If you do not specify a username or password it will try to use the defaults which are 'admin' and 'password'.

Authentication via QS_SERVER Environment Variable

Rather than having to specify the --server argument over and over again you can set an environment variable once then it will use this as the default appliance IP address and credentials. The form of the variable is like so:

export QS_SERVER=ipaddress[,username,password]]

Examples:

export QS_SERVER=localhost,admin,password
export QS_SERVER=10.0.5.10,admin,mypass123
export QS_SERVER=myhostname.domain.net,mike,mypass123

Authentication via .qs.cnf Configuration File

Finally, rather than using an environment variable you can also create a file in your home directory called .qs.cnf with your credentials in it. Here's an example of how to create the file:

echo "192.168.0.10,admin,password" > ~/.qs.cnf
chmod 600 ~/.qs.cnf

Usage

The general usage format for all CLI commands is as follows:

    
qs command <-mandatory-arg=val> [-optional-arg=val] [-flags=force,async,...] [-server=ipaddress[,username,password]] [-xml] [-min] 

As you read through the CLI documentation note that all arguments that are specified in angle backets <> are mandatory required arguments. Arguments in square brackets [] are optional and you'll generally see the default argument specified in the documentation. Note that the qs CLI is installed on your QuantaStor system so you can run it from there, or from a Windows system using our Remote Management CLI Installer found on the downloads page. All commands can be run against a remote QuantaStor storage system using the --server= argument as outlined above.

Note also that anytime you must specify an object argument like host= volume= share= or others you can refer to the object by name or by its unique ID (UUID). For scripting it is always best to be more exact and use the UUID but it can be a big time-saver to be able to refer to objects by name as well, hence this capability.

Output Modes

XML Output Mode

Use --xml with any command to get the results in XML. Example:

qs disk-list --server=localhost,admin,password --xml
qs volume-list --server=localhost,admin,password

Minimal Output Mode

Use --min with any list or enumeration command where you want the results in a more compact format.

Interactive Mode

You can use the qs command line utility in an interactive mode where you will not have to run it from the shell each time. To enter the interactive mode just run the CLI like so:

qs i

To exit the interactive command line mode simply press CTRL-C to exit.

Built-in CLI Help

All of the commands covered in the documentation are also documented within the command line utility itself. Simply run the CLI with the 'help' argument to get the full list of all the different CLI commands. This list is pretty long so it's often best to pipe it to more

qs help | more

.

You can also use the help system to get information on a specific command:

    qs help command=CMD-NAME

As an example you can get help on how to use the pool-create command like so:

    qs help command=pool-create

Another way to get information on a group of commands is to specify a category. Help will then be printed for all commands that have a partial name match to the category specified. For example, to see all the commands that have 'pool' in their name:

    qs help category=pool

Or to see all list or get commands:

    qs help category=list
    qs help category=get

In this way you can reduce down help results to just what you need.

Remote System Specification

You can use the CLI to manage remote QuantaStor systems, but in such cases you'll need to specify the IP address and username/password of the remote storage system using the 'server' argument.

qs command [--server=ipaddress[,username,password]] [command-args]
example: qs disk-list --server=192.168.0.88,admin,password --xml

Note that the The service specification must be comma delimited with no spaces. If no username and password are supplied the default Administrator username 'admin' and the default password 'password' will be tried.

Command Error Code Definitions

For all commands a 0 is returned for SUCCESS and a non-zero error code is returned if there is a command failure. Use the --xml mode to get verbose detail on the error. Full list of error codes are available here.

CLI Usage Examples

It's always nice to see some common examples of how the CLI can be used so here's a number of commands so you can see the general syntax of how the CLI is used. You'll notice that sometimes we specify arguments with a single hyphen (-), other times with the double hyphen (--) and sometimes it is omitted. All three are supported. The only hard rule is that the command name must be the first argument after the 'qs' command-line utility name. After that the arguments can be specified in any order with or without hyphens.

    qs help -min
    qs pool-list
    qs volume-list -xml
    qs volume-create name=vol1 size=100G pool=pool0
    qs volume-create vol1 100G pool0 -xml --server=192.168.0.88,admin,password 

CLI Commands

The following list of commands is the complete list of everything you can do from the CLI. In fact, the list of CLI commands is a pretty close 1-to-1 match with our SOAP based management interface API set. As such, anything you can do via the web management interface, you can do through the CLI, and with the XML output mode you can easily integrate your QuantaStor system with any automated provisioning system in any language. Note that we list the command names along with a short version in square brackets (ex: help [h]). If you find yourself using the CLI frequently learning the short command names can make the CLI easier to work with as it reduces the amount of typing required. For scripting, it's often better to use the long command names as it makes your script easier to read and maintain.

General Commands

help
Display help for all commands. 'qs help' provides a verbose listing of all commands with their input parameters. Use 'qs help --min' for a compacted list of commands, or use 'qs help --category=<some category>' for help on aspecific category or command (for example, 'qs help --category=volume').
 qs help|h [--command=value ] [--category=value ] [--wiki=value ] [--api=value ] 
  command A specific CLI command to get detailed help with.
  category Category of commands to get help with (acl, alert, host, host-group, license, role, session, schedule, pool, quota, system, volume, volume-group, task, user, user-group).
  wiki Generates help output in a format that's importable into MediaWiki.
  api Generates help output in a parsable format for automating API.


tc-commands
List of commands for tab completion
 qs tc-commands [--command=value ] 
  command Command to show method args for.


Alert Management [ALERT]


BACKUP-POLICY Backup Policy Management


CEPH Ceph Management


CLOUD-BACKUP Cloud Container Management


DISK Physical Disk Management


GRID Storage System Grid Management


HA-FAILOVER Storage Pool HA Failover Management


HOST Host Management


HOST-GROUP Host Group Management


HWRAID Hardware RAID Management


HWSWITCH SAS Switch Management


LICENSE License Management


METRICS Cloud I/O Stats Management


POOL Storage Pool Management


QOSPOLICY QoS Policy Management


QUOTA Resource Group Quota Management


REPLICATION Remote Replication Management


RESOURCE-DOMAIN Resource Domain Management


RESOURCE-GROUP Multitenant Resource Group Management


ROLE RBAC Role Management


SCHEDULE Snapshot Schedule Management


SESSION iSCSI Session Management


SHARE Network Share Management


SITE Site Resource Management


SWC Software Controller / iSCSI SAN Adapter


SYSTEM Storage System Management


SYSTEM-LINK Storage System Replication Link Management


TAG Tag/Object Property Management


TARGET-PORT Network Interface Management


TASK Task Management


TRACE-LEVEL Trace Level Management


USER User Management


USER-GROUP User Group Management


VOLUME Storage Volume Management


VOLUME-ACLS Storage Volume Access Control (LUN Masking)


VOLUME-GROUP Storage Volume Group Management