Questo contenuto non è disponibile nella lingua selezionata.
27.4. Using libStorageMgmt
libStorageMgmt
interactively, use the lsmcli tool.
- A Uniform Resource Identifier (URI) which is used to identify the plug-in to connect to the array and any configurable options the array requires.
- A valid user name and password for the array.
plugin+optional-transport://user-name@host:port/?query-string-parameters
Example 27.1. Examples of Different Plug-in Requirements
sim://
ontap+ssl://root@filer.company.com/
smis+ssl://admin@provider.com:5989/?namespace=root/emc
- Pass the URI as part of the command.
lsmcli -u sim://
$ lsmcli -u sim://
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Store the URI in an environmental variable.
export LSMCLI_URI=sim://
$ export LSMCLI_URI=sim://
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Place the URI in the file
~/.lsmcli
, which contains name-value pairs separated by "=". The only currently supported configuration is 'uri'.
-P
option on the command line or by placing it in an environmental variable LSMCLI_PASSWORD
.
Example 27.2. Example of lsmcli
lsmcli list --type SYSTEMS
$ lsmcli list --type SYSTEMS
ID | Name | Status
-------+-------------------------------+--------
sim-01 | LSM simulated storage plug-in | OK
lsmcli volume-create --name volume_name --size 20G --pool POO1 -H
$ lsmcli volume-create --name volume_name --size 20G --pool POO1 -H
ID | Name | vpd83 | bs | #blocks | status | ...
-----+-------------+----------------------------------+-----+----------+--------+----
Vol1 | volume_name | F7DDF7CA945C66238F593BC38137BD2F | 512 | 41943040 | OK | ...
lsmcli --create-access-group example_ag --id iqn.1994-05.com.domain:01.89bd01 --type ISCSI --system sim-01
$ lsmcli --create-access-group example_ag --id iqn.1994-05.com.domain:01.89bd01 --type ISCSI --system sim-01
ID | Name | Initiator ID |SystemID
---------------------------------+------------+----------------------------------+--------
782d00c8ac63819d6cca7069282e03a0 | example_ag | iqn.1994-05.com.domain:01.89bd01 |sim-01
lsmcli access-group-create --name example_ag --init iqn.1994-05.com.domain:01.89bd01 --init-type ISCSI --sys sim-01
$ lsmcli access-group-create --name example_ag --init iqn.1994-05.com.domain:01.89bd01 --init-type ISCSI --sys sim-01
ID | Name | Initiator IDs | System ID
---------------------------------+------------+----------------------------------+-----------
782d00c8ac63819d6cca7069282e03a0 | example_ag | iqn.1994-05.com.domain:01.89bd01 | sim-01
lsmcli access-group-grant --ag 782d00c8ac63819d6cca7069282e03a0 --vol Vol1 --access RW
$ lsmcli access-group-grant --ag 782d00c8ac63819d6cca7069282e03a0 --vol Vol1 --access RW
-b
option on the command line. If the exit code is 0 the command is completed. If the exit code is 7 the command is in progress and a job identifier is written to standard output. The user or script can then take the job ID and query the status of the command as needed by using lsmcli --jobstatus JobID
. If the job is now completed, the exit value will be 0 and the results printed to standard output. If the command is still in progress, the return value will be 7 and the percentage complete will be printed to the standard output.
Example 27.3. An Asynchronous Example
-b
option so that the command returns immediately.
lsmcli volume-create --name async_created --size 20G --pool POO1 -b JOB_3
$ lsmcli volume-create --name async_created --size 20G --pool POO1 -b JOB_3
echo $?
$ echo $?
7
lsmcli job-status --job JOB_3
$ lsmcli job-status --job JOB_3lsmcli job-status --job JOB_3
33
echo $?
$ echo $?
7
lsmcli job-status --job JOB_3
$ lsmcli job-status --job JOB_3lsmcli job-status --job JOB_3
ID | Name | vpd83 | Block Size | ...
-----+---------------+----------------------------------+-------------+-----
Vol2 | async_created | 855C9BA51991B0CC122A3791996F6B15 | 512 | ...
-t SeparatorCharacters
option. This will make it easier to parse the output.
Example 27.4. Scripting Examples
lsmcli list --type volumes -t#
$ lsmcli list --type volumes -t#
Vol1#volume_name#049167B5D09EC0A173E92A63F6C3EA2A#512#41943040#21474836480#OK#sim-01#POO1
Vol2#async_created#3E771A2E807F68A32FA5E15C235B60CC#512#41943040#21474836480#OK#sim-01#POO1
lsmcli list --type volumes -t " | "
$ lsmcli list --type volumes -t " | "
Vol1 | volume_name | 049167B5D09EC0A173E92A63F6C3EA2A | 512 | 41943040 | 21474836480 | OK | 21474836480 | sim-01 | POO1
Vol2 | async_created | 3E771A2E807F68A32FA5E15C235B60CC | 512 | 41943040 | 21474836480 | OK | sim-01 | POO1
lsmcli
man page or lsmcli --help
.