Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The "softnas-cmd" The "softnas-cmd" command line interface utility facilitates integration with the REST API as a CLI (command line interface).  softnas-cmd is written in CURL and is cross-platform code. It may also be useful as example code for how to use the API, for those who wish to explore it in more detail as a working example. This document has been produced by running `softnas-cmd --help`.

...

As with all SoftNAS API applications, softnas-cmd requires that you first authenticate with the SoftNAS server using the "login" command.  Once you are logged in, softnas-cmd maintains a simulated cookie jar that emulates how a browser interacts with a web server to maintain session security (required by the SoftNAS server).  Subsequent commands issued via the softnas-cmd CLI make use of the login session (which expires after 30 minutes).

Usage:

softnas-cmd [-h | --help] | [[-b | --base_url URL] [-s | --session_id SESSION_ID]  [-i | --insecure] | [-t | --pretty_print] COMMAND [OPTIONS]]

 

OPTIONS:

    -h [command name], --help [command name]

...

Display json result with indentation.


Commands:

Table of Contents
maxLevel2
minLevel2

login  

Login into SoftNAS Application.

COMMAND OPTIONS:

username

password

EXAMPLE:

softnas-cmd login softnas Pass4W0rd


logout 

Logout from SoftNAS Application.

EXAMPLE:

softnas-cmd logout

resetsessiontimer

This command is used to keep session active. By default session timeout is set to 30 minutes. if you want to keep session from being expired just call this function.    

EXAMPLE:

softnas-cmd resetsessiontimer

licenseinfo

Returns the current license information.  

EXAMPLE:

softnas-cmd licenseinfo


licenseactivate

Activate a license key for use with SoftNAS

COMMAND OPTIONS:

 licencekey: the licence key; i.e., "softnas"

...

hardware id: can be obtained from "licenseinfo" in amazon the hardware id is the instance id     

EXAMPLE:

softnas-cmd licenseactivate CEAASA-BESNJA-8MEED6-AHAZZN-XHWB8X-A2NUK3 RBLLC i-0b06fe44

internallicense

Force SoftNAS to use its built-in, default license.


EXAMPLE:

softnas-cmd internallicense


ackagreement

Acknowledge the license agreement (to enable use of the product).

EXAMPLE:

softnas-cmd ackagreement

checkupdate

Check to see if new software updates are available.

EXAMPLE:

softnas-cmd internallicense

executeupdate

Execute and apply software updates.

EXAMPLE:

softnas-cmd executeupdate

statusupdate

Return the status of an update that is in-progress (started by executeupdate).

EXAMPLE:

softnas-cmd statusupdate

availabledisks

Returns list of available disk devices.

EXAMPLE:

softnas-cmd availabledisks


pools  

Lists available storage pools.

COMMAND OPTIONS:

start: position to start from (used for pagination)

limit: number of items to get

EXAMPLE:

softnas-cmd pools 1 10


pooldetails

List a storage pool's detailed attributes.

COMMAND OPTIONS:

pool name: the pool name

EXAMPLE:

softnas-cmd pooldetails pool1


poolcommand

Issue a command to control a storage pool.

COMMAND OPTIONS:

command name: zpool command name (startscrub, stopscrub, setonline, setoffline, removedevice, replacedevice)

pool name: the pool name

EXAMPLE:

softnas-cmd poolcommand <command> [arguments]

deletepool

Delete pool storage.

COMMAND OPTIONS:

pool name: the pool name

EXAMPLE:

softnas-cmd deletepool pool1


volumes

List available storage volumes.

COMMAND OPTIONS:

start: position to start from (used for pagination)

limit: number of items to get

EXAMPLE:

softnas-cmd volumes 1 10

createvolume

Create a volume.     

COMMAND OPTIONS:

vol_name: name of volume

pool: selected pool name

...

- disabled: this disables synchronous requests. File system  transactions are only committed to stable storage periodically. This option will give the highest performance.  However, it is very dangerous as ZFS would be ignoring the synchronous transaction demands of applications such as databases or NFS.  Administrators should only use this option when the risks are understood.

EXAMPLE:

softnas-cmd createvolume vol_name=volume5 pool=pool3 vol_type=filesystem provisioning=thin exportNFS=on shareCIFS=on dedup=on enable_snapshot=on schedule_name=Default hourlysnaps=5 dailysnaps=10 weeklysnaps=0 sync=always

editvolume

Edit a volume.

EXAMPLE:

softnas-cmd availabledisks

deletevolume

Delete a volume.

COMMAND OPTIONS:

volume name: name of volume

pool name: pool name

EXAMPLE:

softnas-cmd deletevolume volume6 pool3


schedulelist

List available schedules.

EXAMPLE:

softnas-cmd schedulelist

snapshotlist

List available snapshots.

COMMAND OPTIONS:

pool name: pool name i.e 'pool3/vol1'

...

limit: number of items to get

EXAMPLE:

softnas-cmd snapshotlist pool3/vol1 0 10

 

...

snapcommand

        issue Issue a volume snapshot control command.       

COMMAND OPTIONS:

            command: possible values

                - create  create: create new snapshot. Related options:

                    - pool_name     name: pool name i.e 'pool3/vol1'

                    - volume_name   name: volume name

                - clone  clone: clone snapshot. Related options:                   

- pool_

...

name: pool name i.e 'pool3/vol1'

...

- volume_

...

name: volume name

...

- snap_

...

name: snapshot name to be cloned

...

- delete: delete snaphot list

...

-

...

snapshots: list of snapshot to be deleted in this format "poolname,volumename,snapshotname:poolname1,volumename1,snapshotname1". see example

       

EXAMPLE 1 :

...

Create snapshot.           

softnas-cmd snapcommand create pool_name=pool1 volume_name=vol1

...

EXAMPLE 2 :

...

Clone snapshot.           

softnas-cmd snapcommand clone pool_name=pool1 volume_name=vol1 snap_name=snaphot1

...

EXAMPLE 3 :

...

Delete snapshots.            softnas

softnas-cmd snapcommand delete 'snapshots=pool1,volume1,snap-20150605-140647-cloned-Jun52015-141106:pool1,volume1,snap-20150606-070607'

...

...


iscsitargetlist

        Provides a list of available iSCSI targets.       

COMMAND OPTIONS:

            start       start: position to start from (used for pagination)

            limit       limit: number of items to get

            returnGlobals

...


EXAMPLE:

softnas-cmd iscsitargetlist  0 10

...

 

...


diskdevices

        list List of available disk devices and their status       

EXAMPLE:

softnas-cmd diskdevices

 

...


diskmgmt

        issue Issue a disk management command.       

COMMAND OPTIONS:

            command: possible values

                - createS3disk  createS3disk: create s3 disk. Related options:

                    - awsAccessKey      AWSAccessKey: s3 aws AWS access key id

                    - awsSecretKey      AWSSecretKey: s3 aws AWS secret key

                    - s3bucket          s3bucket: s3 bucket name must be unique

                    - bucketroot        bucketroot: s3 bucket root

                    - sizeMaxValue      sizeMaxValue: Disk size

                    - sizeMaxUnits      sizeMaxUnits: Size unit TB or GB

                    - diskpassword      diskpassword: disk password protection

                    - encrypted         encrypted: add it to encrypt disk                   

- readahead         :                    - blockCacheDevice  readahead: loads file contents into page cache

- blockCacheDevice: s3 cache device

                    - region            region: aws AWS region. Possible values :                       

- us-west-2,

...

oregon: oregon

...

- us-west-1, northern_

...

california: northern california

...

- eu-west-1,

...

ireland: ireland

...

- ap-southeast-1,

...

singapore: singapore

...

- ap-southeast-2,

...

sydney: sydney

...

- ap-northeast-1,

...

tokyo: tokyo

...

- ap-northeast-1,

...

seoul: seoul

...

- sa-east-1, sao_

...

paulo: sao paulo

...

- eu-central-1,

...

frankfurt: frankfurt

...

- us-gov-west-1,

...

govcloud: govcloud

...

 - us-east-1, virginia,

...

default: virginia

                - deleteS3disk  deleteS3disk: delete s3 disk

                    - s3diskname        s3diskname: s3 disk name  i.e (/dev/s3-0)

                - getS3settings: get list of s3 setting stored in config file

                - bucketlist    bucketlist: get list of aws AWS s3 buckets

                - createEBSdisk: create EBS disk. Related options :

                    - awsAccessKey      AWSAccessKey: s3 aws AWS access key id

                    - awsSecretKey      AWSSecretKey: s3 aws AWS secret key

                    - sizeMaxValue      sizeMaxValue: Disk size in GB

                    - type              type: Disk type. Possible values:

                        - gp2       gp2 : General Purpose (SSD)

                        - io1       io1: Provisioned IOPS (SSD). Related option:                           

-

...

iops: Number of Input/Output Operations Per Second

                        - standard  standard: Standard

                    - numberDisks       numberDisks: Number of disks to add

                    - deleteOnTermination: Enable delete on termination                   

- prewarming        prewarming: Enable prewarmingpre-warming

                - createAzureDisk  createAzureDisk: create Azure disk. Related options:                   

-

...

username: Azure account username

...

-

...

password: Azure account password

...

-

...

storageAccount: Azure storage account

...

-

...

sizeMaxValue: Disk size

...

-

...

sizeMaxUnits: Size unit TB or GB

...

-

...

numberDisks: Number of disks to add

                - createExtenderDisk    createExtenderDisk: create extender disk. Related options:                   

-

...

type: establishes disk type. Possible values are: centurylink, cloudian, dunkel, google, hitachi, netapp, azureBlob, custom

...

-

...

accessKey: access key for Azure account

...

-

...

secretKey: secret key for Azure account

...

-

...

bucketName: Azure bucket name

...

-

...

sizeMaxValue: Disk size

...

-

...

sizeMaxUnits: Size unit TB or GB

...

-

...

encrypted: password for encrypting the disk

...


EXAMPLE 1:

...

Create s3 disk.           

softnas-cmd diskmgmt createS3disk

...

 AWSAccessKey=YOUR_AWS_ACCESS_KEY_ID

...

 AWSSecretKey=YOUR_AWS_SECRET_KEY s3bucket=softnas-test-1 bucketroot=softnas sizeMaxValue=500 sizeMaxUnits=GB region=default encrypted diskpassword=password123* readahead blockCacheDevice=/dev/xvdf  

...

EXAMPLE 2:

...

Get list of buckets.           

softnas-cmd diskmgmt bucketlist

...


EXAMPLE 3:

...

Get list of s3 setting stored in config file.           

softnas-cmd diskmgmt getS3settings

...


EXAMPLE 4:

...

Delete S3 disk.           

softnas-cmd diskmgmt deleteS3disk "/dev/s3-0"

...


EXAMPLE 5:

Create EBS Disk General Purpose (SSD).           

softnas-cmd diskmgmt createEBSdisk

...

 AWSAccessKey=XXXXXXXXXXXXXXXXXX

...

 AWSSecretKey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' sizeMaxValue=10 type=gp2 numberDisks=2 deleteOnTermination prewarming -t

...


EXAMPLE 6:

Create EBS Disk Provisioned IOPS (SSD).

...

softnas-cmd diskmgmt createEBSdisk

...

 AWSAccessKey=XXXXXXXXXXXXXXXXXX

...

 AWSSecretKey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' sizeMaxValue=100 type=io1 iops=3000 numberDisks=2 deleteOnTermination prewarming -t

...


EXAMPLE 7 :

Create azure Azure Disk.           

softnas-cmd diskmgmt createAzureDisk username=softnas password=Pass4W0rd storageAccount=SoftnasStorage sizeMaxValue=100 sizeMaxUnits=GB -t

...

...

parted_command

        issue Issue a disk partitioning command.       

COMMAND OPTIONS:

            command: possible values

                - partition_all     all: partion partition all disk disks that are not partionedpartitioned

                - add_partition: adds a partition to specified disk/s

                - remove_partition                : removes a partition from specified disk/s

- disk name         name: selected disk device name       

EXAMPLE:

softnas-cmd parted_command add_partition dev/xvdr

 

...

snaprepcommand

        issue Issue SnapReplicate command.       

COMMAND OPTIONS:

            command command: possible  possible values               

-

...

snapverify: verify the remote node. Related options:

...

-

...

remotenode: ip adress of remote node

...

-

...

userid: username for remote node

...

-

...

password: password of remote node

                - initsnapreplicate     initsnapreplicate: begin initial replicate with remote node                   

-

...

type: type of remote node possible values source or target

...

-

...

remotenode:

...

 ip adress of remote node

...

-

...

userid:

...

 username for remote node

...

-

...

password:

...

 password of remote node

                - keyexchange           keyexchange: Exchange servers keys and allow remote servers ssh connection for each node                   

-

...

keyfile: public key file path (/var/www/softnas/keys/SoftNAS-PrimaryPublic.pem)

...

-

...

pubEncoded: Keyfile content base64 encoded

...

-

...

serverEncoded: rsa public host key content file base 64 encoded (/etc/ssh/ssh_host_rsa_key.pub)

...

-

...

serverIP: server node ip (sender)

                - snapreplicatestatus   snapreplicatestatus: get the current status of replication                   

-

...

start: position to start from (used for pagination)

...

-

...

limit: number of items to get

                - snapreplog            snapreplog: get snapreplicate log                   

-

...

start: position to start from (used for pagination)

...

-

...

limit: number of items to get

                - snapreplicatetasks    snapreplicatetasks: get snapreplicate tasks                   

-

...

start: position to start from (used for pagination)

...

-

...

limit: number of items to get

                - forcesync             : force full synchronization of all volumes image or specific volume between nodes

...

                - add               : Begin Add configuration of SNAP HA from the SnapReplicate "source" node

                    - awsAccessKey      AWSAccessKey      : aws AWS Access Key

                    - awsSecretKey      AWSSecretKey      : aws AWS Secret Key

                    - ha_type           : Possible values :

...

                                            - EIP : for aws AWS elastic IP

                    - vip               : virtual IP (AWS Elastic IP)

...

            softnas-cmd backup create 'yourAwsAccessKeyyourAWSAccessKey' 'yourAwsSecretKeyyourAWSSecretKey' --pretty_print

        EXAMPLE 3 : restore ebs snapshot

            softnas-cmd backup restore 'SnapshotID' 'yourAwsAccessKeyyourAWSAccessKey' 'yourAwsSecretKeyyourAWSSecretKey' --pretty_print

        EXAMPLE 4 : delete ebs snapshot

...